2
* $Xorg: TextP.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $
6
/***********************************************************
8
Copyright 1987, 1988, 1994, 1998 The Open Group
10
Permission to use, copy, modify, distribute, and sell this software and its
11
documentation for any purpose is hereby granted without fee, provided that
12
the above copyright notice appear in all copies and that both that
13
copyright notice and this permission notice appear in supporting
16
The above copyright notice and this permission notice shall be included in
17
all copies or substantial portions of the Software.
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
Except as contained in this notice, the name of The Open Group shall not be
27
used in advertising or otherwise to promote the sale, use or other dealings
28
in this Software without prior written authorization from The Open Group.
31
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
35
Permission to use, copy, modify, and distribute this software and its
36
documentation for any purpose and without fee is hereby granted,
37
provided that the above copyright notice appear in all copies and that
38
both that copyright notice and this permission notice appear in
39
supporting documentation, and that the name of Digital not be
40
used in advertising or publicity pertaining to distribution of the
41
software without specific, written prior permission.
43
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
44
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
45
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
46
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
47
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
48
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
51
******************************************************************/
52
/* $XFree86: xc/lib/Xaw/TextP.h,v 3.22 2001/12/19 21:37:31 dawes Exp $ */
57
#include <X11/Xfuncproto.h>
59
#include <X11/Xaw/Text.h>
60
#include <X11/Xaw/SimpleP.h>
64
#define MAXCUT 30000 /* Maximum number of characters that can be cut */
66
#define XawTextGetLastPosition(ctx) \
67
XawTextSourceScan((ctx)->text.source, 0, \
68
XawstAll, XawsdRight, 1, True)
69
#define GETLASTPOS XawTextGetLastPosition(ctx)
71
#define zeroPosition ((XawTextPosition)0)
73
extern XtActionsRec _XawTextActionsTable[];
74
extern Cardinal _XawTextActionsTableCount;
83
#define XawBSLASH '\\'
85
/* constants that subclasses may want to know */
86
#define DEFAULT_TEXT_HEIGHT ((Dimension)~0)
87
#define DEFAULT_TAB_SIZE 8
89
/* displayable text management data structures */
91
XawTextPosition position;
94
unsigned int textWidth;
98
} XawTextLineTableEntry, *XawTextLineTableEntryPtr;
101
XawTextPosition left, right;
102
XawTextSelectType type;
108
typedef struct _XawTextSelectionSalt {
109
struct _XawTextSelectionSalt *next;
112
* The element "contents" stores the CT string which is gotten in the
113
* function _XawTextSaltAwaySelection()
117
} XawTextSelectionSalt;
120
typedef struct _XawTextKillRing {
121
struct _XawTextKillRing *next;
125
unsigned long format;
128
extern XawTextKillRing *xaw_text_kill_ring;
131
/* Line Tables are n+1 long - last position displayed is in last lt entry */
133
XawTextPosition top; /* Top of the displayed text */
134
int lines; /* How many lines in this table */
136
int base_line; /* line number of first entry */
138
XawTextLineTableEntry *info; /* A dynamic array, one entry per line */
139
} XawTextLineTable, *XawTextLineTablePtr;
141
typedef struct _XawTextMargin {
142
Position left, right, top, bottom;
145
typedef struct _XmuScanline XmuTextUpdate;
147
#define VMargins(ctx) ((ctx)->text.margin.top + (ctx)->text.margin.bottom)
148
#define HMargins(ctx) ((ctx)->text.left_margin + (ctx)->text.margin.right)
149
#define RVMargins(ctx) ((ctx)->text.r_margin.top + (ctx)->text.r_margin.bottom)
150
#define RHMargins(ctx) ((ctx)->text.r_margin.left + (ctx)->text.r_margin.right)
152
#define IsPositionVisible(ctx, pos) \
153
(pos >= ctx->text.lt.info[0].position && \
154
pos < ctx->text.lt.info[ctx->text.lt.lines].position)
157
* Search & Replace data structure
159
struct SearchAndReplace {
160
Boolean selection_changed; /* flag so that the selection cannot be
161
changed out from underneath query-replace.*/
162
Widget search_popup; /* The poppup widget that allows searches.*/
163
Widget label1; /* The label widgets for the search window. */
165
Widget left_toggle; /* The left search toggle radioGroup. */
166
Widget right_toggle; /* The right search toggle radioGroup. */
167
Widget rep_label; /* The Replace label string. */
168
Widget rep_text; /* The Replace text field. */
169
Widget search_text; /* The Search text field. */
170
Widget rep_one; /* The Replace one button. */
171
Widget rep_all; /* The Replace all button. */
173
Widget case_sensitive; /* The "Case Sensitive" toggle */
177
/* New fields for the Text widget class record */
182
/* Full class record declaration */
183
typedef struct _TextClassRec {
184
CoreClassPart core_class;
185
SimpleClassPart simple_class;
186
TextClassPart text_class;
189
extern TextClassRec textClassRec;
191
/* New fields for the Text widget record */
192
typedef struct _TextPart {
195
XawTextPosition insertPos;
197
XawTextSelectType *sarray; /* Array to cycle for selections */
198
XawTextSelectionSalt *salt; /* salted away selections */
200
int dialog_horiz_offset, dialog_vert_offset; /* position for popup dialog */
201
Boolean display_caret; /* insertion pt visible iff T */
202
Boolean auto_fill; /* Auto fill mode? */
203
XawTextScrollMode scroll_vert, scroll_horiz;
204
XawTextWrapMode wrap; /* The type of wrapping */
205
XawTextResizeMode resize;
206
XawTextMargin r_margin; /* The real margins */
208
XtCallbackList position_callbacks;
214
XawTextMargin margin; /* The current margins */
216
XawTextScanDirection extendDir;
217
XawTextSelection origSel; /* the selection being modified */
218
Time lasttime; /* timestamp of last processed action */
219
Time time; /* time of last key or button action */
220
Position ev_x, ev_y; /* x, y coords for key or button action */
221
Widget vbar, hbar; /* The scroll bars (none = NULL) */
222
struct SearchAndReplace *search; /* Search and replace structure */
223
Widget file_insert; /* The file insert popup widget */
224
XmuTextUpdate *update; /* Position intervals to update */
228
unsigned char kill_ring;
229
Boolean selection_state;
234
int from_left; /* Cursor position */
235
XawTextPosition lastPos; /* Last position of source */
237
Boolean showposition; /* True if we need to show the position */
238
Boolean hasfocus; /* TRUE if we currently have input focus*/
239
Boolean update_disabled; /* TRUE if display updating turned off */
240
Boolean clear_to_eol; /* Clear to eol when painting text? */
241
XawTextPosition old_insert; /* Last insertPos for batched updates */
242
short mult; /* Multiplier */
244
XawTextKillRing *kill_ring_ptr;
249
/* private state, shared w/Source and Sink */
250
Boolean redisplay_needed; /* in SetValues */
251
XawTextSelectionSalt *salt2; /* salted away selections */
256
Boolean overwrite; /* Overwrite mode */
258
/* new resources and states, for text edition
259
* Note: a fixed width font is required for these resources/states.
261
short left_column, right_column;
262
XawTextJustifyMode justify;
263
XtPointer pad[4]; /* for future use and keep binary compatability */
267
#define XtRWrapMode "WrapMode"
268
#define XtRScrollMode "ScrollMode"
269
#define XtRResizeMode "ResizeMode"
270
#define XtRJustifyMode "JustifyMode"
272
/* full instance record */
273
typedef struct _TextRec {
280
* Semi-private functions
281
* for use by other Xaw modules only
283
void _XawTextBuildLineTable
286
XawTextPosition top_pos,
287
_XtBoolean force_rebuild
290
char *_XawTextGetSTRING
293
XawTextPosition left,
294
XawTextPosition right
297
void _XawTextSaltAwaySelection
312
void _XawTextNeedsUpdating
315
XawTextPosition left,
316
XawTextPosition right
321
#endif /* _XawTextP_h */