1/*
2 * tkText.h --
3 *
4 *	Declarations shared among the files that implement text widgets.
5 *
6 * Copyright (c) 1992-1994 The Regents of the University of California.
7 * Copyright (c) 1994-1995 Sun Microsystems, Inc.
8 *
9 * See the file "license.terms" for information on usage and redistribution of
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id$
13 */
14
15#ifndef _TKTEXT
16#define _TKTEXT
17
18#ifndef _TK
19#include "tk.h"
20#endif
21
22#ifndef _TKUNDO
23#include "tkUndo.h"
24#endif
25
26#ifdef BUILD_tk
27# undef TCL_STORAGE_CLASS
28# define TCL_STORAGE_CLASS DLLEXPORT
29#endif
30
31/*
32 * Opaque types for structures whose guts are only needed by a single file.
33 */
34
35typedef struct TkTextBTree_ *TkTextBTree;
36
37/*
38 * The data structure below defines a single logical line of text (from
39 * newline to newline, not necessarily what appears on one display line of the
40 * screen).
41 */
42
43typedef struct TkTextLine {
44    struct Node *parentPtr;	/* Pointer to parent node containing line. */
45    struct TkTextLine *nextPtr;	/* Next in linked list of lines with same
46				 * parent node in B-tree. NULL means end of
47				 * list. */
48    struct TkTextSegment *segPtr;
49				/* First in ordered list of segments that make
50				 * up the line. */
51    int *pixels;		/* Array containing two integers for each
52				 * referring text widget. The first of these
53				 * is the number of vertical pixels taken up
54				 * by this line, whether currently displayed
55				 * or not. This number is only updated
56				 * asychronously. The second of these is the
57				 * last epoch at which the pixel height was
58				 * recalculated. */
59} TkTextLine;
60
61/*
62 * -----------------------------------------------------------------------
63 * Segments: each line is divided into one or more segments, where each
64 * segment is one of several things, such as a group of characters, a tag
65 * toggle, a mark, or an embedded widget. Each segment starts with a standard
66 * header followed by a body that varies from type to type.
67 * -----------------------------------------------------------------------
68 */
69
70/*
71 * The data structure below defines the body of a segment that represents a
72 * tag toggle. There is one of these structures at both the beginning and end
73 * of each tagged range.
74 */
75
76typedef struct TkTextToggle {
77    struct TkTextTag *tagPtr;	/* Tag that starts or ends here. */
78    int inNodeCounts;		/* 1 means this toggle has been accounted for
79				 * in node toggle counts; 0 means it hasn't,
80				 * yet. */
81} TkTextToggle;
82
83/*
84 * The data structure below defines line segments that represent marks. There
85 * is one of these for each mark in the text.
86 */
87
88typedef struct TkTextMark {
89    struct TkText *textPtr;	/* Overall information about text widget. */
90    TkTextLine *linePtr;	/* Line structure that contains the
91				 * segment. */
92    Tcl_HashEntry *hPtr;	/* Pointer to hash table entry for mark (in
93				 * sharedTextPtr->markTable). */
94} TkTextMark;
95
96/*
97 * A structure of the following type holds information for each window
98 * embedded in a text widget. This information is only used by the file
99 * tkTextWind.c
100 */
101
102typedef struct TkTextEmbWindowClient {
103    struct TkText *textPtr;	/* Information about the overall text
104				 * widget. */
105    Tk_Window tkwin;		/* Window for this segment. NULL means that
106				 * the window hasn't been created yet. */
107    int chunkCount;		/* Number of display chunks that refer to this
108				 * window. */
109    int displayed;		/* Non-zero means that the window has been
110				 * displayed on the screen recently. */
111    struct TkTextSegment *parent;
112    struct TkTextEmbWindowClient *next;
113} TkTextEmbWindowClient;
114
115typedef struct TkTextEmbWindow {
116    struct TkSharedText *sharedTextPtr;
117				/* Information about the shared portion of the
118				 * text widget. */
119    Tk_Window tkwin;		/* Window for this segment. This is just a
120				 * temporary value, copied from 'clients', to
121				 * make option table updating easier. NULL
122				 * means that the window hasn't been created
123				 * yet. */
124    TkTextLine *linePtr;	/* Line structure that contains this
125				 * window. */
126    char *create;		/* Script to create window on-demand. NULL
127				 * means no such script. Malloc-ed. */
128    int align;			/* How to align window in vertical space. See
129				 * definitions in tkTextWind.c. */
130    int padX, padY;		/* Padding to leave around each side of
131				 * window, in pixels. */
132    int stretch;		/* Should window stretch to fill vertical
133				 * space of line (except for pady)? 0 or 1. */
134    Tk_OptionTable optionTable;	/* Token representing the configuration
135				 * specifications. */
136    TkTextEmbWindowClient *clients;
137				/* Linked list of peer-widget specific
138				 * information for this embedded window. */
139} TkTextEmbWindow;
140
141/*
142 * A structure of the following type holds information for each image embedded
143 * in a text widget. This information is only used by the file tkTextImage.c
144 */
145
146typedef struct TkTextEmbImage {
147    struct TkSharedText *sharedTextPtr;
148				/* Information about the shared portion of the
149				 * text widget. This is used when the image
150				 * changes or is deleted. */
151    TkTextLine *linePtr;	/* Line structure that contains this image. */
152    char *imageString;		/* Name of the image for this segment. */
153    char *imageName;		/* Name used by text widget to identify this
154				 * image. May be unique-ified. */
155    char *name;			/* Name used in the hash table. Used by
156				 * "image names" to identify this instance of
157				 * the image. */
158    Tk_Image image;		/* Image for this segment. NULL means that the
159				 * image hasn't been created yet. */
160    int align;			/* How to align image in vertical space. See
161				 * definitions in tkTextImage.c. */
162    int padX, padY;		/* Padding to leave around each side of image,
163				 * in pixels. */
164    int chunkCount;		/* Number of display chunks that refer to this
165				 * image. */
166    Tk_OptionTable optionTable;	/* Token representing the configuration
167				 * specifications. */
168} TkTextEmbImage;
169
170/*
171 * The data structure below defines line segments.
172 */
173
174typedef struct TkTextSegment {
175    const struct Tk_SegType *typePtr;
176				/* Pointer to record describing segment's
177				 * type. */
178    struct TkTextSegment *nextPtr;
179				/* Next in list of segments for this line, or
180				 * NULL for end of list. */
181    int size;			/* Size of this segment (# of bytes of index
182				 * space it occupies). */
183    union {
184	char chars[4];		/* Characters that make up character info.
185				 * Actual length varies to hold as many
186				 * characters as needed.*/
187	TkTextToggle toggle;	/* Information about tag toggle. */
188	TkTextMark mark;	/* Information about mark. */
189	TkTextEmbWindow ew;	/* Information about embedded window. */
190	TkTextEmbImage ei;	/* Information about embedded image. */
191    } body;
192} TkTextSegment;
193
194/*
195 * Data structures of the type defined below are used during the execution of
196 * Tcl commands to keep track of various interesting places in a text. An
197 * index is only valid up until the next modification to the character
198 * structure of the b-tree so they can't be retained across Tcl commands.
199 * However, mods to marks or tags don't invalidate indices.
200 */
201
202typedef struct TkTextIndex {
203    TkTextBTree tree;		/* Tree containing desired position. */
204    TkTextLine *linePtr;	/* Pointer to line containing position of
205				 * interest. */
206    int byteIndex;		/* Index within line of desired character (0
207				 * means first one). */
208    struct TkText *textPtr;	/* May be NULL, but otherwise the text widget
209				 * with which this index is associated. If not
210				 * NULL, then we have a refCount on the
211				 * widget. */
212} TkTextIndex;
213
214/*
215 * Types for procedure pointers stored in TkTextDispChunk strutures:
216 */
217
218typedef struct TkTextDispChunk TkTextDispChunk;
219
220typedef void 		Tk_ChunkDisplayProc(struct TkText *textPtr,
221			    TkTextDispChunk *chunkPtr, int x, int y,
222			    int height, int baseline, Display *display,
223			    Drawable dst, int screenY);
224typedef void		Tk_ChunkUndisplayProc(struct TkText *textPtr,
225			    TkTextDispChunk *chunkPtr);
226typedef int		Tk_ChunkMeasureProc(TkTextDispChunk *chunkPtr, int x);
227typedef void		Tk_ChunkBboxProc(struct TkText *textPtr,
228			    TkTextDispChunk *chunkPtr, int index, int y,
229			    int lineHeight, int baseline, int *xPtr,
230			    int *yPtr, int *widthPtr, int *heightPtr);
231
232/*
233 * The structure below represents a chunk of stuff that is displayed together
234 * on the screen. This structure is allocated and freed by generic display
235 * code but most of its fields are filled in by segment-type-specific code.
236 */
237
238struct TkTextDispChunk {
239    /*
240     * The fields below are set by the type-independent code before calling
241     * the segment-type-specific layoutProc. They should not be modified by
242     * segment-type-specific code.
243     */
244
245    int x;			/* X position of chunk, in pixels. This
246				 * position is measured from the left edge of
247				 * the logical line, not from the left edge of
248				 * the window (i.e. it doesn't change under
249				 * horizontal scrolling). */
250    struct TkTextDispChunk *nextPtr;
251				/* Next chunk in the display line or NULL for
252				 * the end of the list. */
253    struct TextStyle *stylePtr;	/* Display information, known only to
254				 * tkTextDisp.c. */
255
256    /*
257     * The fields below are set by the layoutProc that creates the chunk.
258     */
259
260    Tk_ChunkDisplayProc *displayProc;
261				/* Procedure to invoke to draw this chunk on
262				 * the display or an off-screen pixmap. */
263    Tk_ChunkUndisplayProc *undisplayProc;
264				/* Procedure to invoke when segment ceases to
265				 * be displayed on screen anymore. */
266    Tk_ChunkMeasureProc *measureProc;
267				/* Procedure to find character under a given
268				 * x-location. */
269    Tk_ChunkBboxProc *bboxProc;	/* Procedure to find bounding box of character
270				 * in chunk. */
271    int numBytes;		/* Number of bytes that will be displayed in
272				 * the chunk. */
273    int minAscent;		/* Minimum space above the baseline needed by
274				 * this chunk. */
275    int minDescent;		/* Minimum space below the baseline needed by
276				 * this chunk. */
277    int minHeight;		/* Minimum total line height needed by this
278				 * chunk. */
279    int width;			/* Width of this chunk, in pixels. Initially
280				 * set by chunk-specific code, but may be
281				 * increased to include tab or extra space at
282				 * end of line. */
283    int breakIndex;		/* Index within chunk of last acceptable
284				 * position for a line (break just before this
285				 * byte index). <= 0 means don't break during
286				 * or immediately after this chunk. */
287    ClientData clientData;	/* Additional information for use of
288				 * displayProc and undisplayProc. */
289};
290
291/*
292 * One data structure of the following type is used for each tag in a text
293 * widget. These structures are kept in sharedTextPtr->tagTable and referred
294 * to in other structures.
295 */
296
297typedef enum {
298    TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD,
299    TEXT_WRAPMODE_NULL
300} TkWrapMode;
301
302typedef struct TkTextTag {
303    const char *name;		/* Name of this tag. This field is actually a
304				 * pointer to the key from the entry in
305				 * sharedTextPtr->tagTable, so it needn't be
306				 * freed explicitly. For 'sel' tags this is
307				 * just a static string, so again need not be
308				 * freed. */
309    const struct TkText *textPtr;
310				/* If non-NULL, then this tag only applies to
311				 * the given text widget (when there are peer
312				 * widgets). */
313    int priority;		/* Priority of this tag within widget. 0 means
314				 * lowest priority. Exactly one tag has each
315				 * integer value between 0 and numTags-1. */
316    struct Node *tagRootPtr;	/* Pointer into the B-Tree at the lowest node
317				 * that completely dominates the ranges of
318				 * text occupied by the tag. At this node
319				 * there is no information about the tag. One
320				 * or more children of the node do contain
321				 * information about the tag. */
322    int toggleCount;		/* Total number of tag toggles. */
323
324    /*
325     * Information for displaying text with this tag. The information belows
326     * acts as an override on information specified by lower-priority tags.
327     * If no value is specified, then the next-lower-priority tag on the text
328     * determins the value. The text widget itself provides defaults if no tag
329     * specifies an override.
330     */
331
332    Tk_3DBorder border;		/* Used for drawing background. NULL means no
333				 * value specified here. */
334    int borderWidth;		/* Width of 3-D border for background. */
335    Tcl_Obj *borderWidthPtr;	/* Width of 3-D border for background. */
336    char *reliefString;		/* -relief option string (malloc-ed). NULL
337				 * means option not specified. */
338    int relief;			/* 3-D relief for background. */
339    Pixmap bgStipple;		/* Stipple bitmap for background. None means
340				 * no value specified here. */
341    XColor *fgColor;		/* Foreground color for text. NULL means no
342				 * value specified here. */
343    Tk_Font tkfont;		/* Font for displaying text. NULL means no
344				 * value specified here. */
345    Pixmap fgStipple;		/* Stipple bitmap for text and other
346				 * foreground stuff. None means no value
347				 * specified here.*/
348    char *justifyString;	/* -justify option string (malloc-ed). NULL
349				 * means option not specified. */
350    Tk_Justify justify;		/* How to justify text: TK_JUSTIFY_LEFT,
351				 * TK_JUSTIFY_RIGHT, or TK_JUSTIFY_CENTER.
352				 * Only valid if justifyString is non-NULL. */
353    char *lMargin1String;	/* -lmargin1 option string (malloc-ed). NULL
354				 * means option not specified. */
355    int lMargin1;		/* Left margin for first display line of each
356				 * text line, in pixels. Only valid if
357				 * lMargin1String is non-NULL. */
358    char *lMargin2String;	/* -lmargin2 option string (malloc-ed). NULL
359				 * means option not specified. */
360    int lMargin2;		/* Left margin for second and later display
361				 * lines of each text line, in pixels. Only
362				 * valid if lMargin2String is non-NULL. */
363    char *offsetString;		/* -offset option string (malloc-ed). NULL
364				 * means option not specified. */
365    int offset;			/* Vertical offset of text's baseline from
366				 * baseline of line. Used for superscripts and
367				 * subscripts. Only valid if offsetString is
368				 * non-NULL. */
369    char *overstrikeString;	/* -overstrike option string (malloc-ed). NULL
370				 * means option not specified. */
371    int overstrike;		/* Non-zero means draw horizontal line through
372				 * middle of text. Only valid if
373				 * overstrikeString is non-NULL. */
374    char *rMarginString;	/* -rmargin option string (malloc-ed). NULL
375				 * means option not specified. */
376    int rMargin;		/* Right margin for text, in pixels. Only
377				 * valid if rMarginString is non-NULL. */
378    char *spacing1String;	/* -spacing1 option string (malloc-ed). NULL
379				 * means option not specified. */
380    int spacing1;		/* Extra spacing above first display line for
381				 * text line. Only valid if spacing1String is
382				 * non-NULL. */
383    char *spacing2String;	/* -spacing2 option string (malloc-ed). NULL
384				 * means option not specified. */
385    int spacing2;		/* Extra spacing between display lines for the
386				 * same text line. Only valid if
387				 * spacing2String is non-NULL. */
388    char *spacing3String;	/* -spacing2 option string (malloc-ed). NULL
389				 * means option not specified. */
390    int spacing3;		/* Extra spacing below last display line for
391				 * text line. Only valid if spacing3String is
392				 * non-NULL. */
393    Tcl_Obj *tabStringPtr;	/* -tabs option string. NULL means option not
394				 * specified. */
395    struct TkTextTabArray *tabArrayPtr;
396				/* Info about tabs for tag (malloc-ed) or
397				 * NULL. Corresponds to tabString. */
398    int tabStyle;		/* One of TABULAR or WORDPROCESSOR or NONE (if
399				 * not specified). */
400    char *underlineString;	/* -underline option string (malloc-ed). NULL
401				 * means option not specified. */
402    int underline;		/* Non-zero means draw underline underneath
403				 * text. Only valid if underlineString is
404				 * non-NULL. */
405    TkWrapMode wrapMode;	/* How to handle wrap-around for this tag.
406				 * Must be TEXT_WRAPMODE_CHAR,
407				 * TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD, or
408				 * TEXT_WRAPMODE_NULL to use wrapmode for
409				 * whole widget. */
410    char *elideString;		/* -elide option string (malloc-ed). NULL
411				 * means option not specified. */
412    int elide;			/* Non-zero means that data under this tag
413				 * should not be displayed. */
414    int affectsDisplay;		/* Non-zero means that this tag affects the
415				 * way information is displayed on the screen
416				 * (so need to redisplay if tag changes). */
417    Tk_OptionTable optionTable;	/* Token representing the configuration
418				 * specifications. */
419    int affectsDisplayGeometry;	/* Non-zero means that this tag affects the
420				 * size with which information is displayed on
421				 * the screen (so need to recalculate line
422				 * dimensions if tag changes). */
423} TkTextTag;
424
425#define TK_TAG_AFFECTS_DISPLAY	0x1
426#define TK_TAG_UNDERLINE	0x2
427#define TK_TAG_JUSTIFY		0x4
428#define TK_TAG_OFFSET		0x10
429
430/*
431 * The data structure below is used for searching a B-tree for transitions on
432 * a single tag (or for all tag transitions). No code outside of tkTextBTree.c
433 * should ever modify any of the fields in these structures, but it's OK to
434 * use them for read-only information.
435 */
436
437typedef struct TkTextSearch {
438    TkTextIndex curIndex;	/* Position of last tag transition returned by
439				 * TkBTreeNextTag, or index of start of
440				 * segment containing starting position for
441				 * search if TkBTreeNextTag hasn't been called
442				 * yet, or same as stopIndex if search is
443				 * over. */
444    TkTextSegment *segPtr;	/* Actual tag segment returned by last call to
445				 * TkBTreeNextTag, or NULL if TkBTreeNextTag
446				 * hasn't returned anything yet. */
447    TkTextSegment *nextPtr;	/* Where to resume search in next call to
448				 * TkBTreeNextTag. */
449    TkTextSegment *lastPtr;	/* Stop search before just before considering
450				 * this segment. */
451    TkTextTag *tagPtr;		/* Tag to search for (or tag found, if allTags
452				 * is non-zero). */
453    int linesLeft;		/* Lines left to search (including curIndex
454				 * and stopIndex). When this becomes <= 0 the
455				 * search is over. */
456    int allTags;		/* Non-zero means ignore tag check: search for
457				 * transitions on all tags. */
458} TkTextSearch;
459
460/*
461 * The following data structure describes a single tab stop. It must be kept
462 * in sync with the 'tabOptionStrings' array in the function 'TkTextGetTabs'
463 */
464
465typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign;
466
467/*
468 * The following are the supported styles of tabbing, used for the -tabstyle
469 * option of the text widget. The last element is only used for tag options.
470 */
471
472typedef enum {
473    TK_TEXT_TABSTYLE_TABULAR,
474    TK_TEXT_TABSTYLE_WORDPROCESSOR,
475    TK_TEXT_TABSTYLE_NONE
476} TkTextTabStyle;
477
478typedef struct TkTextTab {
479    int location;		/* Offset in pixels of this tab stop from the
480				 * left margin (lmargin2) of the text. */
481    TkTextTabAlign alignment;	/* Where the tab stop appears relative to the
482				 * text. */
483} TkTextTab;
484
485typedef struct TkTextTabArray {
486    int numTabs;		/* Number of tab stops. */
487    double lastTab;		/* The accurate fractional pixel position of
488				 * the last tab. */
489    double tabIncrement;	/* The accurate fractional pixel increment
490				 * between interpolated tabs we have to create
491				 * when we exceed numTabs. */
492    TkTextTab tabs[1];		/* Array of tabs. The actual size will be
493				 * numTabs. THIS FIELD MUST BE THE LAST IN THE
494				 * STRUCTURE. */
495} TkTextTabArray;
496
497/*
498 * Enumeration definining the edit modes of the widget.
499 */
500
501typedef enum {
502    TK_TEXT_EDIT_INSERT,	/* insert mode */
503    TK_TEXT_EDIT_DELETE,	/* delete mode */
504    TK_TEXT_EDIT_REPLACE,	/* replace mode */
505    TK_TEXT_EDIT_OTHER		/* none of the above */
506} TkTextEditMode;
507
508/*
509 * Enumeration defining the ways in which a text widget may be modified (for
510 * undo/redo handling).
511 */
512
513typedef enum {
514    TK_TEXT_DIRTY_NORMAL,	/* Normal behavior. */
515    TK_TEXT_DIRTY_UNDO,		/* Reverting a compound action. */
516    TK_TEXT_DIRTY_REDO,		/* Reapplying a compound action. */
517    TK_TEXT_DIRTY_FIXED		/* Forced to be dirty; can't be undone/redone
518				 * by normal activity. */
519} TkTextDirtyMode;
520
521/*
522 * The following enum is used to define a type for the -state option of the
523 * Text widget.
524 */
525
526typedef enum {
527    TK_TEXT_STATE_DISABLED, TK_TEXT_STATE_NORMAL
528} TkTextState;
529
530/*
531 * A data structure of the following type is shared between each text widget
532 * that are peers.
533 */
534
535typedef struct TkSharedText {
536    int refCount;		/* Reference count this shared object. */
537    TkTextBTree tree;		/* B-tree representation of text and tags for
538				 * widget. */
539    Tcl_HashTable tagTable;	/* Hash table that maps from tag names to
540				 * pointers to TkTextTag structures. The "sel"
541				 * tag does not feature in this table, since
542				 * there's one of those for each text peer. */
543    int numTags;		/* Number of tags currently defined for
544				 * widget; needed to keep track of
545				 * priorities. */
546    Tcl_HashTable markTable;	/* Hash table that maps from mark names to
547				 * pointers to mark segments. The special
548				 * "insert" and "current" marks are not stored
549				 * in this table, but directly accessed as
550				 * fields of textPtr. */
551    Tcl_HashTable windowTable;	/* Hash table that maps from window names to
552				 * pointers to window segments. If a window
553				 * segment doesn't yet have an associated
554				 * window, there is no entry for it here. */
555    Tcl_HashTable imageTable;	/* Hash table that maps from image names to
556				 * pointers to image segments. If an image
557				 * segment doesn't yet have an associated
558				 * image, there is no entry for it here. */
559    Tk_BindingTable bindingTable;
560				/* Table of all bindings currently defined for
561				 * this widget. NULL means that no bindings
562				 * exist, so the table hasn't been created.
563				 * Each "object" used for this table is the
564				 * name of a tag. */
565    int stateEpoch;		/* This is incremented each time the B-tree's
566				 * contents change structurally, and means
567				 * that any cached TkTextIndex objects are no
568				 * longer valid. */
569
570    /*
571     * Information related to the undo/redo functionality.
572     */
573
574    TkUndoRedoStack *undoStack;	/* The undo/redo stack. */
575    int undo;			/* Non-zero means the undo/redo behaviour is
576				 * enabled. */
577    int maxUndo;		/* The maximum depth of the undo stack
578				 * expressed as the maximum number of compound
579				 * statements. */
580    int autoSeparators;		/* Non-zero means the separators will be
581				 * inserted automatically. */
582    int isDirty;		/* Flag indicating the 'dirtyness' of the
583				 * text widget. If the flag is not zero,
584				 * unsaved modifications have been applied to
585				 * the text widget. */
586    TkTextDirtyMode dirtyMode;	/* The nature of the dirtyness characterized
587				 * by the isDirty flag. */
588    TkTextEditMode lastEditMode;/* Keeps track of what the last edit mode
589				 * was. */
590
591    /*
592     * Keep track of all the peers
593     */
594
595    struct TkText *peers;
596} TkSharedText;
597
598/*
599 * A data structure of the following type is kept for each text widget that
600 * currently exists for this process:
601 */
602
603typedef struct TkText {
604    /*
605     * Information related to and accessed by widget peers and the
606     * TkSharedText handling routines.
607     */
608
609    TkSharedText *sharedTextPtr;/* Shared section of all peers. */
610    struct TkText *next;	/* Next in list of linked peers. */
611    TkTextLine *start;		/* First B-tree line to show, or NULL to start
612				 * at the beginning. */
613    TkTextLine *end;		/* Last B-tree line to show, or NULL for up to
614				 * the end. */
615    int pixelReference;		/* Counter into the current tree reference
616				 * index corresponding to this widget. */
617    int abortSelections;	/* Set to 1 whenever the text is modified in a
618				 * way that interferes with selection
619				 * retrieval: used to abort incremental
620				 * selection retrievals. */
621
622    /*
623     * Standard Tk widget information and text-widget specific items
624     */
625
626    Tk_Window tkwin;		/* Window that embodies the text. NULL means
627				 * that the window has been destroyed but the
628				 * data structures haven't yet been cleaned
629				 * up.*/
630    Display *display;		/* Display for widget. Needed, among other
631				 * things, to allow resources to be freed even
632				 * after tkwin has gone away. */
633    Tcl_Interp *interp;		/* Interpreter associated with widget. Used to
634				 * delete widget command. */
635    Tcl_Command widgetCmd;	/* Token for text's widget command. */
636    int state;			/* Either STATE_NORMAL or STATE_DISABLED. A
637				 * text widget is read-only when disabled. */
638
639    /*
640     * Default information for displaying (may be overridden by tags applied
641     * to ranges of characters).
642     */
643
644    Tk_3DBorder border;		/* Structure used to draw 3-D border and
645				 * default background. */
646    int borderWidth;		/* Width of 3-D border to draw around entire
647				 * widget. */
648    int padX, padY;		/* Padding between text and window border. */
649    int relief;			/* 3-d effect for border around entire widget:
650				 * TK_RELIEF_RAISED etc. */
651    int highlightWidth;		/* Width in pixels of highlight to draw around
652				 * widget when it has the focus. <= 0 means
653				 * don't draw a highlight. */
654    XColor *highlightBgColorPtr;
655				/* Color for drawing traversal highlight area
656				 * when highlight is off. */
657    XColor *highlightColorPtr;	/* Color for drawing traversal highlight. */
658    Tk_Cursor cursor;		/* Current cursor for window, or None. */
659    XColor *fgColor;		/* Default foreground color for text. */
660    Tk_Font tkfont;		/* Default font for displaying text. */
661    int charWidth;		/* Width of average character in default
662				 * font. */
663    int charHeight;		/* Height of average character in default
664				 * font, including line spacing. */
665    int spacing1;		/* Default extra spacing above first display
666				 * line for each text line. */
667    int spacing2;		/* Default extra spacing between display lines
668				 * for the same text line. */
669    int spacing3;		/* Default extra spacing below last display
670				 * line for each text line. */
671    Tcl_Obj *tabOptionPtr; 	/* Value of -tabs option string. */
672    TkTextTabArray *tabArrayPtr;
673				/* Information about tab stops (malloc'ed).
674				 * NULL means perform default tabbing
675				 * behavior. */
676    int tabStyle;		/* One of TABULAR or WORDPROCESSOR. */
677
678    /*
679     * Additional information used for displaying:
680     */
681
682    TkWrapMode wrapMode;	/* How to handle wrap-around. Must be
683				 * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
684				 * TEXT_WRAPMODE_WORD. */
685    int width, height;		/* Desired dimensions for window, measured in
686				 * characters. */
687    int setGrid;		/* Non-zero means pass gridding information to
688				 * window manager. */
689    int prevWidth, prevHeight;	/* Last known dimensions of window; used to
690				 * detect changes in size. */
691    TkTextIndex topIndex;	/* Identifies first character in top display
692				 * line of window. */
693    struct TextDInfo *dInfoPtr;	/* Information maintained by tkTextDisp.c. */
694
695    /*
696     * Information related to selection.
697     */
698
699    TkTextTag *selTagPtr;	/* Pointer to "sel" tag. Used to tell when a
700				 * new selection has been made. */
701    Tk_3DBorder selBorder;	/* Border and background for selected
702				 * characters. This is a copy of information
703				 * in *selTagPtr, so it shouldn't be
704				 * explicitly freed. */
705    Tk_3DBorder inactiveSelBorder;
706				/* Border and background for selected
707				 * characters when they don't have the
708				 * focus. */
709    int selBorderWidth;		/* Width of border around selection. */
710    Tcl_Obj *selBorderWidthPtr;	/* Width of border around selection. */
711    XColor *selFgColorPtr;	/* Foreground color for selected text. This is
712				 * a copy of information in *selTagPtr, so it
713				 * shouldn't be explicitly freed. */
714    int exportSelection;	/* Non-zero means tie "sel" tag to X
715				 * selection. */
716    TkTextIndex selIndex;	/* Used during multi-pass selection
717				 * retrievals. This index identifies the next
718				 * character to be returned from the
719				 * selection. */
720
721    /*
722     * Information related to insertion cursor:
723     */
724
725    TkTextSegment *insertMarkPtr;
726				/* Points to segment for "insert" mark. */
727    Tk_3DBorder insertBorder;	/* Used to draw vertical bar for insertion
728				 * cursor. */
729    int insertWidth;		/* Total width of insert cursor. */
730    int insertBorderWidth;	/* Width of 3-D border around insert cursor. */
731    int insertOnTime;		/* Number of milliseconds cursor should spend
732				 * in "on" state for each blink. */
733    int insertOffTime;		/* Number of milliseconds cursor should spend
734				 * in "off" state for each blink. */
735    Tcl_TimerToken insertBlinkHandler;
736				/* Timer handler used to blink cursor on and
737				 * off. */
738
739    /*
740     * Information used for event bindings associated with tags:
741     */
742
743    TkTextSegment *currentMarkPtr;
744				/* Pointer to segment for "current" mark, or
745				 * NULL if none. */
746    XEvent pickEvent;		/* The event from which the current character
747				 * was chosen. Must be saved so that we can
748				 * repick after modifications to the text. */
749    int numCurTags;		/* Number of tags associated with character at
750				 * current mark. */
751    TkTextTag **curTagArrayPtr;	/* Pointer to array of tags for current mark,
752				 * or NULL if none. */
753
754    /*
755     * Miscellaneous additional information:
756     */
757
758    char *takeFocus;		/* Value of -takeFocus option; not used in the
759				 * C code, but used by keyboard traversal
760				 * scripts. Malloc'ed, but may be NULL. */
761    char *xScrollCmd;		/* Prefix of command to issue to update
762				 * horizontal scrollbar when view changes. */
763    char *yScrollCmd;		/* Prefix of command to issue to update
764				 * vertical scrollbar when view changes. */
765    int flags;			/* Miscellaneous flags; see below for
766				 * definitions. */
767    Tk_OptionTable optionTable;	/* Token representing the configuration
768				 * specifications. */
769    int refCount;		/* Number of cached TkTextIndex objects
770				 * refering to us. */
771    int insertCursorType;	/* 0 = standard insertion cursor, 1 = block
772				 * cursor. */
773
774    /*
775     * Copies of information from the shared section relating to the undo/redo
776     * functonality
777     */
778
779    int undo;			/* Non-zero means the undo/redo behaviour is
780				 * enabled. */
781    int maxUndo;		/* The maximum depth of the undo stack
782				 * expressed as the maximum number of compound
783				 * statements. */
784    int autoSeparators;		/* Non-zero means the separators will be
785				 * inserted automatically. */
786} TkText;
787
788/*
789 * Flag values for TkText records:
790 *
791 * GOT_SELECTION:		Non-zero means we've already claimed the
792 *				selection.
793 * INSERT_ON:			Non-zero means insertion cursor should be
794 *				displayed on screen.
795 * GOT_FOCUS:			Non-zero means this window has the input
796 *				focus.
797 * BUTTON_DOWN:			1 means that a mouse button is currently down;
798 *				this is used to implement grabs for the
799 *				duration of button presses.
800 * UPDATE_SCROLLBARS:		Non-zero means scrollbar(s) should be updated
801 *				during next redisplay operation.
802 * NEED_REPICK			This appears unused and should probably be
803 *				ignored.
804 * OPTIONS_FREED		The widget's options have been freed.
805 * DESTROYED			The widget is going away.
806 */
807
808#define GOT_SELECTION		1
809#define INSERT_ON		2
810#define GOT_FOCUS		4
811#define BUTTON_DOWN		8
812#define UPDATE_SCROLLBARS	0x10
813#define NEED_REPICK		0x20
814#define OPTIONS_FREED		0x40
815#define DESTROYED		0x80
816
817/*
818 * Records of the following type define segment types in terms of a collection
819 * of procedures that may be called to manipulate segments of that type.
820 */
821
822typedef TkTextSegment *	Tk_SegSplitProc(struct TkTextSegment *segPtr,
823			    int index);
824typedef int		Tk_SegDeleteProc(struct TkTextSegment *segPtr,
825			    TkTextLine *linePtr, int treeGone);
826typedef TkTextSegment *	Tk_SegCleanupProc(struct TkTextSegment *segPtr,
827			    TkTextLine *linePtr);
828typedef void		Tk_SegLineChangeProc(struct TkTextSegment *segPtr,
829			    TkTextLine *linePtr);
830typedef int		Tk_SegLayoutProc(struct TkText *textPtr,
831			    struct TkTextIndex *indexPtr,
832			    TkTextSegment *segPtr, int offset, int maxX,
833			    int maxChars, int noCharsYet, TkWrapMode wrapMode,
834			    struct TkTextDispChunk *chunkPtr);
835typedef void		Tk_SegCheckProc(TkTextSegment *segPtr,
836			    TkTextLine *linePtr);
837
838typedef struct Tk_SegType {
839    const char *name;		/* Name of this kind of segment. */
840    int leftGravity;		/* If a segment has zero size (e.g. a mark or
841				 * tag toggle), does it attach to character to
842				 * its left or right? 1 means left, 0 means
843				 * right. */
844    Tk_SegSplitProc *splitProc;	/* Procedure to split large segment into two
845				 * smaller ones. */
846    Tk_SegDeleteProc *deleteProc;
847				/* Procedure to call to delete segment. */
848    Tk_SegCleanupProc *cleanupProc;
849				/* After any change to a line, this procedure
850				 * is invoked for all segments left in the
851				 * line to perform any cleanup they wish
852				 * (e.g. joining neighboring segments). */
853    Tk_SegLineChangeProc *lineChangeProc;
854				/* Invoked when a segment is about to be moved
855				 * from its current line to an earlier line
856				 * because of a deletion. The linePtr is that
857				 * for the segment's old line. CleanupProc
858				 * will be invoked after the deletion is
859				 * finished. */
860    Tk_SegLayoutProc *layoutProc;
861				/* Returns size information when figuring out
862				 * what to display in window. */
863    Tk_SegCheckProc *checkProc;	/* Called during consistency checks to check
864				 * internal consistency of segment. */
865} Tk_SegType;
866
867/*
868 * The following type and items describe different flags for text widget items
869 * to count. They are used in both tkText.c and tkTextIndex.c, in
870 * 'CountIndices', 'TkTextIndexBackChars', 'TkTextIndexForwChars', and
871 * 'TkTextIndexCount'.
872 */
873
874typedef int TkTextCountType;
875
876#define COUNT_CHARS 0
877#define COUNT_INDICES 1
878#define COUNT_DISPLAY 2
879#define COUNT_DISPLAY_CHARS (COUNT_CHARS | COUNT_DISPLAY)
880#define COUNT_DISPLAY_INDICES (COUNT_INDICES | COUNT_DISPLAY)
881
882/*
883 * The following structure is used to keep track of elided text taking account
884 * of different tag priorities, it is need for quick calculations of whether a
885 * single index is elided, and to start at a given index and maintain a
886 * correct elide state as we move or count forwards or backwards.
887 */
888
889#define LOTSA_TAGS 1000
890typedef struct TkTextElideInfo {
891    int numTags;		/* Total tags in widget. */
892    int elide;			/* Is the state currently elided. */
893    int elidePriority;		/* Tag priority controlling elide state. */
894    TkTextSegment *segPtr;	/* Segment to look at next. */
895    int segOffset;		/* Offset of segment within line. */
896    int deftagCnts[LOTSA_TAGS];
897    TkTextTag *deftagPtrs[LOTSA_TAGS];
898    int *tagCnts;		/* 0 or 1 depending if the tag with that
899				 * priority is on or off. */
900    TkTextTag **tagPtrs;	/* Only filled with a tagPtr if the
901				 * corresponding tagCnt is 1. */
902} TkTextElideInfo;
903
904/*
905 * The constant below is used to specify a line when what is really wanted is
906 * the entire text. For now, just use a very big number.
907 */
908
909#define TK_END_OF_TEXT		1000000
910
911/*
912 * The following definition specifies the maximum number of characters needed
913 * in a string to hold a position specifier.
914 */
915
916#define TK_POS_CHARS		30
917
918/*
919 * Mask used for those options which may impact the pixel height calculations
920 * of individual lines displayed in the widget.
921 */
922
923#define TK_TEXT_LINE_GEOMETRY	1
924
925/*
926 * Mask used for those options which may impact the start and end lines used
927 * in the widget.
928 */
929
930#define TK_TEXT_LINE_RANGE	2
931
932/*
933 * Used as 'action' values in calls to TkTextInvalidateLineMetrics
934 */
935
936#define TK_TEXT_INVALIDATE_ONLY		0
937#define TK_TEXT_INVALIDATE_INSERT	1
938#define TK_TEXT_INVALIDATE_DELETE	2
939
940/*
941 * Used as special 'pickPlace' values in calls to TkTextSetYView. Zero or
942 * positive values indicate a number of pixels.
943 */
944
945#define TK_TEXT_PICKPLACE	-1
946#define TK_TEXT_NOPIXELADJUST	-2
947
948/*
949 * Declarations for variables shared among the text-related files:
950 */
951
952MODULE_SCOPE int	tkBTreeDebug;
953MODULE_SCOPE int	tkTextDebug;
954MODULE_SCOPE const Tk_SegType tkTextCharType;
955MODULE_SCOPE const Tk_SegType tkTextLeftMarkType;
956MODULE_SCOPE const Tk_SegType tkTextRightMarkType;
957MODULE_SCOPE const Tk_SegType tkTextToggleOnType;
958MODULE_SCOPE const Tk_SegType tkTextToggleOffType;
959
960/*
961 * Convenience macros for use by B-tree clients which want to access pixel
962 * information on each line. Currently only used by TkTextDisp.c
963 */
964
965#define TkBTreeLinePixelCount(text, line) \
966	(line)->pixels[2*(text)->pixelReference]
967#define TkBTreeLinePixelEpoch(text, line) \
968	(line)->pixels[1+2*(text)->pixelReference]
969
970/*
971 * Declarations for procedures that are used by the text-related files but
972 * shouldn't be used anywhere else in Tk (or by Tk clients):
973 */
974
975MODULE_SCOPE int	TkBTreeAdjustPixelHeight(const TkText *textPtr,
976			    TkTextLine *linePtr, int newPixelHeight,
977			    int mergedLogicalLines);
978MODULE_SCOPE int	TkBTreeCharTagged(const TkTextIndex *indexPtr,
979			    TkTextTag *tagPtr);
980MODULE_SCOPE void	TkBTreeCheck(TkTextBTree tree);
981MODULE_SCOPE TkTextBTree TkBTreeCreate(TkSharedText *sharedTextPtr);
982MODULE_SCOPE void	TkBTreeAddClient(TkTextBTree tree, TkText *textPtr,
983			    int defaultHeight);
984MODULE_SCOPE void	TkBTreeClientRangeChanged(TkText *textPtr,
985			    int defaultHeight);
986MODULE_SCOPE void	TkBTreeRemoveClient(TkTextBTree tree,
987			    TkText *textPtr);
988MODULE_SCOPE void	TkBTreeDestroy(TkTextBTree tree);
989MODULE_SCOPE void	TkBTreeDeleteIndexRange(TkTextBTree tree,
990			    TkTextIndex *index1Ptr, TkTextIndex *index2Ptr);
991MODULE_SCOPE int	TkBTreeEpoch(TkTextBTree tree);
992MODULE_SCOPE TkTextLine *TkBTreeFindLine(TkTextBTree tree,
993			    const TkText *textPtr, int line);
994MODULE_SCOPE TkTextLine *TkBTreeFindPixelLine(TkTextBTree tree,
995			    const TkText *textPtr, int pixels,
996			    int *pixelOffset);
997MODULE_SCOPE TkTextTag **TkBTreeGetTags(const TkTextIndex *indexPtr,
998			    const TkText *textPtr, int *numTagsPtr);
999MODULE_SCOPE void	TkBTreeInsertChars(TkTextBTree tree,
1000			    TkTextIndex *indexPtr, const char *string);
1001MODULE_SCOPE int	TkBTreeLinesTo(const TkText *textPtr,
1002			    TkTextLine *linePtr);
1003MODULE_SCOPE int	TkBTreePixelsTo(const TkText *textPtr,
1004			    TkTextLine *linePtr);
1005MODULE_SCOPE void	TkBTreeLinkSegment(TkTextSegment *segPtr,
1006			    TkTextIndex *indexPtr);
1007MODULE_SCOPE TkTextLine *TkBTreeNextLine(const TkText *textPtr,
1008			    TkTextLine *linePtr);
1009MODULE_SCOPE int	TkBTreeNextTag(TkTextSearch *searchPtr);
1010MODULE_SCOPE int	TkBTreeNumLines(TkTextBTree tree,
1011			    const TkText *textPtr);
1012MODULE_SCOPE int	TkBTreeNumPixels(TkTextBTree tree,
1013			    const TkText *textPtr);
1014MODULE_SCOPE TkTextLine *TkBTreePreviousLine(TkText *textPtr,
1015			    TkTextLine *linePtr);
1016MODULE_SCOPE int	TkBTreePrevTag(TkTextSearch *searchPtr);
1017MODULE_SCOPE void	TkBTreeStartSearch(TkTextIndex *index1Ptr,
1018			    TkTextIndex *index2Ptr, TkTextTag *tagPtr,
1019			    TkTextSearch *searchPtr);
1020MODULE_SCOPE void	TkBTreeStartSearchBack(TkTextIndex *index1Ptr,
1021			    TkTextIndex *index2Ptr, TkTextTag *tagPtr,
1022			    TkTextSearch *searchPtr);
1023MODULE_SCOPE int	TkBTreeTag(TkTextIndex *index1Ptr,
1024			    TkTextIndex *index2Ptr, TkTextTag *tagPtr,
1025			    int add);
1026MODULE_SCOPE void	TkBTreeUnlinkSegment(TkTextSegment *segPtr,
1027			    TkTextLine *linePtr);
1028MODULE_SCOPE void	TkTextBindProc(ClientData clientData,
1029			    XEvent *eventPtr);
1030MODULE_SCOPE void	TkTextSelectionEvent(TkText *textPtr);
1031MODULE_SCOPE void	TkTextChanged(TkSharedText *sharedTextPtr,
1032			    TkText *textPtr, const TkTextIndex *index1Ptr,
1033			    const TkTextIndex *index2Ptr);
1034MODULE_SCOPE int	TkTextIndexBbox(TkText *textPtr,
1035			    const TkTextIndex *indexPtr, int *xPtr, int *yPtr,
1036			    int *widthPtr, int *heightPtr, int *charWidthPtr);
1037MODULE_SCOPE int	TkTextCharLayoutProc(TkText *textPtr,
1038			    TkTextIndex *indexPtr, TkTextSegment *segPtr,
1039			    int offset, int maxX, int maxChars, int noBreakYet,
1040			    TkWrapMode wrapMode, TkTextDispChunk *chunkPtr);
1041MODULE_SCOPE void	TkTextCreateDInfo(TkText *textPtr);
1042MODULE_SCOPE int	TkTextDLineInfo(TkText *textPtr,
1043			    const TkTextIndex *indexPtr, int *xPtr, int *yPtr,
1044			    int *widthPtr, int *heightPtr, int *basePtr);
1045MODULE_SCOPE void	TkTextEmbWinDisplayProc(TkText *textPtr,
1046			    TkTextDispChunk *chunkPtr, int x, int y,
1047			    int lineHeight, int baseline, Display *display,
1048			    Drawable dst, int screenY);
1049MODULE_SCOPE TkTextTag *TkTextCreateTag(TkText *textPtr,
1050			    const char *tagName, int *newTag);
1051MODULE_SCOPE void	TkTextFreeDInfo(TkText *textPtr);
1052MODULE_SCOPE void	TkTextDeleteTag(TkText *textPtr, TkTextTag *tagPtr);
1053MODULE_SCOPE void	TkTextFreeTag(TkText *textPtr, TkTextTag *tagPtr);
1054MODULE_SCOPE int	TkTextGetIndex(Tcl_Interp *interp, TkText *textPtr,
1055			    const char *string, TkTextIndex *indexPtr);
1056MODULE_SCOPE int	TkTextGetObjIndex(Tcl_Interp *interp, TkText *textPtr,
1057			    Tcl_Obj *idxPtr, TkTextIndex *indexPtr);
1058MODULE_SCOPE int	TkTextSharedGetObjIndex(Tcl_Interp *interp,
1059			    TkSharedText *sharedTextPtr, Tcl_Obj *idxPtr,
1060			    TkTextIndex *indexPtr);
1061MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp,
1062			    TkText *textPtr, Tcl_Obj *objPtr);
1063MODULE_SCOPE TkTextTabArray *TkTextGetTabs(Tcl_Interp *interp,
1064			    TkText *textPtr, Tcl_Obj *stringPtr);
1065MODULE_SCOPE void	TkTextFindDisplayLineEnd(TkText *textPtr,
1066			    TkTextIndex *indexPtr, int end, int *xOffset);
1067MODULE_SCOPE int	TkTextIndexBackBytes(const TkText *textPtr,
1068			    const TkTextIndex *srcPtr, int count,
1069			    TkTextIndex *dstPtr);
1070MODULE_SCOPE void	TkTextIndexBackChars(const TkText *textPtr,
1071			    const TkTextIndex *srcPtr, int count,
1072			    TkTextIndex *dstPtr, TkTextCountType type);
1073MODULE_SCOPE int	TkTextIndexCmp(const TkTextIndex *index1Ptr,
1074			    const TkTextIndex *index2Ptr);
1075MODULE_SCOPE int	TkTextIndexCount(const TkText *textPtr,
1076			    const TkTextIndex *index1Ptr,
1077			    const TkTextIndex *index2Ptr,
1078			    TkTextCountType type);
1079MODULE_SCOPE int	TkTextIndexForwBytes(const TkText *textPtr,
1080			    const TkTextIndex *srcPtr, int count,
1081			    TkTextIndex *dstPtr);
1082MODULE_SCOPE void	TkTextIndexForwChars(const TkText *textPtr,
1083			    const TkTextIndex *srcPtr, int count,
1084			    TkTextIndex *dstPtr, TkTextCountType type);
1085MODULE_SCOPE void	TkTextIndexOfX(TkText *textPtr, int x,
1086			    TkTextIndex *indexPtr);
1087MODULE_SCOPE int	TkTextIndexYPixels(TkText *textPtr,
1088			    const TkTextIndex *indexPtr);
1089MODULE_SCOPE TkTextSegment *TkTextIndexToSeg(const TkTextIndex *indexPtr,
1090			    int *offsetPtr);
1091MODULE_SCOPE void	TkTextInsertDisplayProc(TkText *textPtr,
1092			    TkTextDispChunk *chunkPtr, int x, int y,
1093			    int height, int baseline, Display *display,
1094			    Drawable dst, int screenY);
1095MODULE_SCOPE void	TkTextLostSelection(ClientData clientData);
1096MODULE_SCOPE TkTextIndex *TkTextMakeCharIndex(TkTextBTree tree, TkText *textPtr,
1097			    int lineIndex, int charIndex,
1098			    TkTextIndex *indexPtr);
1099MODULE_SCOPE int	TkTextMeasureDown(TkText *textPtr,
1100			    TkTextIndex *srcPtr, int distance);
1101MODULE_SCOPE void	TkTextFreeElideInfo(TkTextElideInfo *infoPtr);
1102MODULE_SCOPE int	TkTextIsElided(const TkText *textPtr,
1103			    const TkTextIndex *indexPtr,
1104			    TkTextElideInfo *infoPtr);
1105MODULE_SCOPE TkTextIndex *TkTextMakeByteIndex(TkTextBTree tree,
1106			    const TkText *textPtr, int lineIndex,
1107			    int byteIndex, TkTextIndex *indexPtr);
1108MODULE_SCOPE int	TkTextMakePixelIndex(TkText *textPtr,
1109			    int pixelIndex, TkTextIndex *indexPtr);
1110MODULE_SCOPE void	TkTextInvalidateLineMetrics(
1111			    TkSharedText *sharedTextPtr, TkText *textPtr,
1112			    TkTextLine *linePtr, int lineCount, int action);
1113MODULE_SCOPE int	TkTextUpdateLineMetrics(TkText *textPtr, int lineNum,
1114			    int endLine, int doThisMuch);
1115MODULE_SCOPE int	TkTextUpdateOneLine(TkText *textPtr,
1116			    TkTextLine *linePtr, int pixelHeight,
1117			    TkTextIndex *indexPtr, int partialCalc);
1118MODULE_SCOPE int	TkTextMarkCmd(TkText *textPtr, Tcl_Interp *interp,
1119			    int objc, Tcl_Obj *const objv[]);
1120MODULE_SCOPE int	TkTextMarkNameToIndex(TkText *textPtr,
1121			    const char *name, TkTextIndex *indexPtr);
1122MODULE_SCOPE void	TkTextMarkSegToIndex(TkText *textPtr,
1123			    TkTextSegment *markPtr, TkTextIndex *indexPtr);
1124MODULE_SCOPE void	TkTextEventuallyRepick(TkText *textPtr);
1125MODULE_SCOPE void	TkTextPickCurrent(TkText *textPtr, XEvent *eventPtr);
1126MODULE_SCOPE void	TkTextPixelIndex(TkText *textPtr, int x, int y,
1127			    TkTextIndex *indexPtr, int *nearest);
1128MODULE_SCOPE int	TkTextPrintIndex(const TkText *textPtr,
1129			    const TkTextIndex *indexPtr, char *string);
1130MODULE_SCOPE Tcl_Obj *	TkTextNewIndexObj(TkText *textPtr,
1131			    const TkTextIndex *indexPtr);
1132MODULE_SCOPE void	TkTextRedrawRegion(TkText *textPtr, int x, int y,
1133			    int width, int height);
1134MODULE_SCOPE void	TkTextRedrawTag(TkSharedText *sharedTextPtr,
1135			    TkText *textPtr, TkTextIndex *index1Ptr,
1136			    TkTextIndex *index2Ptr, TkTextTag *tagPtr,
1137			    int withTag);
1138MODULE_SCOPE void	TkTextRelayoutWindow(TkText *textPtr, int mask);
1139MODULE_SCOPE int	TkTextScanCmd(TkText *textPtr, Tcl_Interp *interp,
1140			    int objc, Tcl_Obj *const objv[]);
1141MODULE_SCOPE int	TkTextSeeCmd(TkText *textPtr, Tcl_Interp *interp,
1142			    int objc, Tcl_Obj *const objv[]);
1143MODULE_SCOPE int	TkTextSegToOffset(const TkTextSegment *segPtr,
1144			    const TkTextLine *linePtr);
1145MODULE_SCOPE TkTextSegment *TkTextSetMark(TkText *textPtr,
1146			    const char *name, TkTextIndex *indexPtr);
1147MODULE_SCOPE void	TkTextSetYView(TkText *textPtr,
1148			    TkTextIndex *indexPtr, int pickPlace);
1149MODULE_SCOPE int	TkTextTagCmd(TkText *textPtr, Tcl_Interp *interp,
1150			    int objc, Tcl_Obj *const objv[]);
1151MODULE_SCOPE int	TkTextImageCmd(TkText *textPtr, Tcl_Interp *interp,
1152			    int objc, Tcl_Obj *const objv[]);
1153MODULE_SCOPE int	TkTextImageIndex(TkText *textPtr,
1154			    const char *name, TkTextIndex *indexPtr);
1155MODULE_SCOPE int	TkTextWindowCmd(TkText *textPtr, Tcl_Interp *interp,
1156			    int objc, Tcl_Obj *const objv[]);
1157MODULE_SCOPE int	TkTextWindowIndex(TkText *textPtr, const char *name,
1158			    TkTextIndex *indexPtr);
1159MODULE_SCOPE int	TkTextXviewCmd(TkText *textPtr, Tcl_Interp *interp,
1160			    int objc, Tcl_Obj *const objv[]);
1161MODULE_SCOPE int	TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp,
1162			    int objc, Tcl_Obj *const objv[]);
1163MODULE_SCOPE void	TkTextWinFreeClient(Tcl_HashEntry *hPtr,
1164			    TkTextEmbWindowClient *client);
1165
1166# undef TCL_STORAGE_CLASS
1167# define TCL_STORAGE_CLASS DLLIMPORT
1168
1169#endif /* _TKTEXT */
1170
1171/*
1172 * Local Variables:
1173 * mode: c
1174 * c-basic-offset: 4
1175 * fill-column: 78
1176 * End:
1177 */
1178