]> www.wagner.pp.ru Git - oss/ck.git/blob - ckText.h
Ck console graphics toolkit
[oss/ck.git] / ckText.h
1 /*
2  * ckText.h --
3  *
4  *      Declarations shared among the files that implement text
5  *      widgets.
6  *
7  * Copyright (c) 1992-1994 The Regents of the University of California.
8  * Copyright (c) 1994-1995 Sun Microsystems, Inc.
9  *
10  * See the file "license.terms" for information on usage and redistribution
11  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12  *
13  */
14
15 #ifndef _CKTEXT_H
16 #define _CKTEXT_H
17
18 #ifndef _CK
19 #include "ck.h"
20 #endif
21
22 /*
23  * Opaque types for structures whose guts are only needed by a single
24  * file:
25  */
26
27 typedef struct CkTextBTree *CkTextBTree;
28
29 /*
30  * The data structure below defines a single line of text (from newline
31  * to newline, not necessarily what appears on one line of the screen).
32  */
33
34 typedef struct CkTextLine {
35     struct Node *parentPtr;             /* Pointer to parent node containing
36                                          * line. */
37     struct CkTextLine *nextPtr;         /* Next in linked list of lines with
38                                          * same parent node in B-tree.  NULL
39                                          * means end of list. */
40     struct CkTextSegment *segPtr;       /* First in ordered list of segments
41                                          * that make up the line. */
42 } CkTextLine;
43
44 /*
45  * -----------------------------------------------------------------------
46  * Segments: each line is divided into one or more segments, where each
47  * segment is one of several things, such as a group of characters, a
48  * tag toggle, a mark, or an embedded widget.  Each segment starts with
49  * a standard header followed by a body that varies from type to type.
50  * -----------------------------------------------------------------------
51  */
52
53 /*
54  * The data structure below defines the body of a segment that represents
55  * a tag toggle.  There is one of these structures at both the beginning
56  * and end of each tagged range.
57  */
58
59 typedef struct CkTextToggle {
60     struct CkTextTag *tagPtr;           /* Tag that starts or ends here. */
61     int inNodeCounts;                   /* 1 means this toggle has been
62                                          * accounted for in node toggle
63                                          * counts; 0 means it hasn't, yet. */
64 } CkTextToggle;
65
66 /*
67  * The data structure below defines line segments that represent
68  * marks.  There is one of these for each mark in the text.
69  */
70
71 typedef struct CkTextMark {
72     struct CkText *textPtr;             /* Overall information about text
73                                          * widget. */
74     CkTextLine *linePtr;                /* Line structure that contains the
75                                          * segment. */
76     Tcl_HashEntry *hPtr;                /* Pointer to hash table entry for mark
77                                          * (in textPtr->markTable). */
78 } CkTextMark;
79
80 /*
81  * A structure of the following type holds information for each window
82  * embedded in a text widget.  This information is only used by the
83  * file ckTextWind.c
84  */
85
86 typedef struct CkTextEmbWindow {
87     struct CkText *textPtr;             /* Information about the overall text
88                                          * widget. */
89     CkTextLine *linePtr;                /* Line structure that contains this
90                                          * window. */
91     CkWindow winPtr;                    /* Window for this segment.  NULL
92                                          * means that the window hasn't
93                                          * been created yet. */
94     char *create;                       /* Script to create window on-demand.
95                                          * NULL means no such script.
96                                          * Malloc-ed. */
97     int align;                          /* How to align window in vertical
98                                          * space.  See definitions in
99                                          * ckTextWind.c. */
100     int padX, padY;                     /* Padding to leave around each side
101                                          * of window, in pixels. */
102     int stretch;                        /* Should window stretch to fill
103                                          * vertical space of line (except for
104                                          * pady)?  0 or 1. */
105     int chunkCount;                     /* Number of display chunks that
106                                          * refer to this window. */
107     int displayed;                      /* Non-zero means that the window
108                                          * has been displayed on the screen
109                                          * recently. */
110 } CkTextEmbWindow;
111
112 /*
113  * The data structure below defines line segments.
114  */
115
116 typedef struct CkTextSegment {
117     struct Ck_SegType *typePtr;         /* Pointer to record describing
118                                          * segment's type. */
119     struct CkTextSegment *nextPtr;      /* Next in list of segments for this
120                                          * line, or NULL for end of list. */
121     int size;                           /* Size of this segment (# of bytes
122                                          * of index space it occupies). */
123     union {
124         char chars[4];                  /* Characters that make up character
125                                          * info.  Actual length varies to
126                                          * hold as many characters as needed.*/
127         CkTextToggle toggle;            /* Information about tag toggle. */
128         CkTextMark mark;                /* Information about mark. */
129         CkTextEmbWindow ew;             /* Information about embedded
130                                          * window. */
131     } body;
132 } CkTextSegment;
133
134 /*
135  * Data structures of the type defined below are used during the
136  * execution of Tcl commands to keep track of various interesting
137  * places in a text.  An index is only valid up until the next
138  * modification to the character structure of the b-tree so they
139  * can't be retained across Tcl commands.  However, mods to marks
140  * or tags don't invalidate indices.
141  */
142
143 typedef struct CkTextIndex {
144     CkTextBTree tree;                   /* Tree containing desired position. */
145     CkTextLine *linePtr;                /* Pointer to line containing position
146                                          * of interest. */
147     int charIndex;                      /* Index within line of desired
148                                          * character (0 means first one). */
149 } CkTextIndex;
150
151 /*
152  * Types for procedure pointers stored in CkTextDispChunk strutures:
153  */
154
155 typedef struct CkTextDispChunk CkTextDispChunk;
156
157 typedef void            Ck_ChunkDisplayProc _ANSI_ARGS_((
158                             CkTextDispChunk *chunkPtr, int x, int y,
159                             int height, int baseline, WINDOW *window,
160                             int screenY));
161 typedef void            Ck_ChunkUndisplayProc _ANSI_ARGS_((
162                             struct CkText *textPtr,
163                             CkTextDispChunk *chunkPtr));
164 typedef int             Ck_ChunkMeasureProc _ANSI_ARGS_((
165                             CkTextDispChunk *chunkPtr, int x));
166 typedef void            Ck_ChunkBboxProc _ANSI_ARGS_((
167                             CkTextDispChunk *chunkPtr, int index, int y,
168                             int lineHeight, int baseline, int *xPtr,
169                             int *yPtr, int *widthPtr, int *heightPtr));
170
171 /*
172  * The structure below represents a chunk of stuff that is displayed
173  * together on the screen.  This structure is allocated and freed by
174  * generic display code but most of its fields are filled in by
175  * segment-type-specific code.
176  */
177
178 struct CkTextDispChunk {
179     /*
180      * The fields below are set by the type-independent code before
181      * calling the segment-type-specific layoutProc.  They should not
182      * be modified by segment-type-specific code.
183      */
184
185     int x;                              /* X position of chunk, in pixels.
186                                          * This position is measured from the
187                                          * left edge of the logical line,
188                                          * not from the left edge of the
189                                          * window (i.e. it doesn't change
190                                          * under horizontal scrolling). */
191     struct CkTextDispChunk *nextPtr;    /* Next chunk in the display line
192                                          * or NULL for the end of the list. */
193     struct Style *stylePtr;             /* Display information, known only
194                                          * to ckTextDisp.c. */
195
196     /*
197      * The fields below are set by the layoutProc that creates the
198      * chunk.
199      */
200
201     Ck_ChunkDisplayProc *displayProc;   /* Procedure to invoke to draw this
202                                          * chunk on the display or an
203                                          * off-screen pixmap. */
204     Ck_ChunkUndisplayProc *undisplayProc;
205                                         /* Procedure to invoke when segment
206                                          * ceases to be displayed on screen
207                                          * anymore. */
208     Ck_ChunkMeasureProc *measureProc;   /* Procedure to find character under
209                                          * a given x-location. */
210     Ck_ChunkBboxProc *bboxProc;         /* Procedure to find bounding box
211                                          * of character in chunk. */
212     int numChars;                       /* Number of characters that will be
213                                          * displayed in the chunk. */
214     int minHeight;                      /* Minimum total line height needed
215                                          * by this chunk. */
216     int width;                          /* Width of this chunk, in pixels.
217                                          * Initially set by chunk-specific
218                                          * code, but may be increased to
219                                          * include tab or extra space at end
220                                          * of line. */
221     int breakIndex;                     /* Index within chunk of last
222                                          * acceptable position for a line
223                                          * (break just before this character).
224                                          * <= 0 means don't break during or
225                                          * immediately after this chunk. */
226     ClientData clientData;              /* Additional information for use
227                                          * of displayProc and undisplayProc. */
228 };
229
230 /*
231  * One data structure of the following type is used for each tag in a
232  * text widget.  These structures are kept in textPtr->tagTable and
233  * referred to in other structures.
234  */
235
236 typedef struct CkTextTag {
237     char *name;                 /* Name of this tag.  This field is actually
238                                  * a pointer to the key from the entry in
239                                  * textPtr->tagTable, so it needn't be freed
240                                  * explicitly. */
241     int priority;               /* Priority of this tag within widget.  0
242                                  * means lowest priority.  Exactly one tag
243                                  * has each integer value between 0 and
244                                  * numTags-1. */
245
246     /*
247      * Information for displaying text with this tag.  The information
248      * belows acts as an override on information specified by lower-priority
249      * tags.  If no value is specified, then the next-lower-priority tag
250      * on the text determins the value.  The text widget itself provides
251      * defaults if no tag specifies an override.
252      */
253
254     int bg, fg, attr;           /* Foreground/background/video attributes
255                                  * for text. -1 means no value specified. */
256     char *justifyString;        /* -justify option string (malloc-ed).
257                                  * NULL means option not specified. */
258     Ck_Justify justify;         /* How to justify text: CK_JUSTIFY_LEFT,
259                                  * CK_JUSTIFY_RIGHT, or CK_JUSTIFY_CENTER.
260                                  * Only valid if justifyString is non-NULL. */
261     char *lMargin1String;       /* -lmargin1 option string (malloc-ed).
262                                  * NULL means option not specified. */
263     int lMargin1;               /* Left margin for first display line of
264                                  * each text line, in pixels.  Only valid
265                                  * if lMargin1String is non-NULL. */
266     char *lMargin2String;       /* -lmargin2 option string (malloc-ed).
267                                  * NULL means option not specified. */
268     int lMargin2;               /* Left margin for second and later display
269                                  * lines of each text line, in pixels.  Only
270                                  * valid if lMargin2String is non-NULL. */
271     char *rMarginString;        /* -rmargin option string (malloc-ed).
272                                  * NULL means option not specified. */
273     int rMargin;                /* Right margin for text, in pixels.  Only
274                                  * valid if rMarginString is non-NULL. */
275     char *tabString;            /* -tabs option string (malloc-ed).
276                                  * NULL means option not specified. */
277     struct CkTextTabArray *tabArrayPtr;
278                                 /* Info about tabs for tag (malloc-ed)
279                                  * or NULL.  Corresponds to tabString. */
280     Ck_Uid wrapMode;            /* How to handle wrap-around for this tag.
281                                  * Must be ckTextCharUid, ckTextNoneUid,
282                                  * ckTextWordUid, or NULL to use wrapMode
283                                  * for whole widget. */
284     int affectsDisplay;         /* Non-zero means that this tag affects the
285                                  * way information is displayed on the screen
286                                  * (so need to redisplay if tag changes). */
287 } CkTextTag;
288
289 #define TK_TAG_AFFECTS_DISPLAY  0x1
290 #define TK_TAG_UNDERLINE        0x2
291 #define TK_TAG_JUSTIFY          0x4
292 #define TK_TAG_OFFSET           0x10
293
294 /*
295  * The data structure below is used for searching a B-tree for transitions
296  * on a single tag (or for all tag transitions).  No code outside of
297  * ckTextBTree.c should ever modify any of the fields in these structures,
298  * but it's OK to use them for read-only information.
299  */
300
301 typedef struct CkTextSearch {
302     CkTextIndex curIndex;               /* Position of last tag transition
303                                          * returned by CkBTreeNextTag, or
304                                          * index of start of segment
305                                          * containing starting position for
306                                          * search if CkBTreeNextTag hasn't
307                                          * been called yet, or same as
308                                          * stopIndex if search is over. */
309     CkTextSegment *segPtr;              /* Actual tag segment returned by last
310                                          * call to CkBTreeNextTag, or NULL if
311                                          * CkBTreeNextTag hasn't returned
312                                          * anything yet. */
313     CkTextSegment *nextPtr;             /* Where to resume search in next
314                                          * call to CkBTreeNextTag. */
315     CkTextSegment *lastPtr;             /* Stop search before just before
316                                          * considering this segment. */
317     CkTextTag *tagPtr;                  /* Tag to search for (or tag found, if
318                                          * allTags is non-zero). */
319     int linesLeft;                      /* Lines left to search (including
320                                          * curIndex and stopIndex).  When
321                                          * this becomes <= 0 the search is
322                                          * over. */
323     int allTags;                        /* Non-zero means ignore tag check:
324                                          * search for transitions on all
325                                          * tags. */
326 } CkTextSearch;
327
328 /*
329  * The following data structure describes a single tab stop.
330  */
331
332 typedef enum {LEFT, RIGHT, CENTER, NUMERIC} CkTextTabAlign;
333
334 typedef struct CkTextTab {
335     int location;                       /* Offset in pixels of this tab stop
336                                          * from the left margin (lmargin2) of
337                                          * the text. */
338     CkTextTabAlign alignment;           /* Where the tab stop appears relative
339                                          * to the text. */
340 } CkTextTab;
341
342 typedef struct CkTextTabArray {
343     int numTabs;                        /* Number of tab stops. */
344     CkTextTab tabs[1];                  /* Array of tabs.  The actual size
345                                          * will be numTabs.  THIS FIELD MUST
346                                          * BE THE LAST IN THE STRUCTURE. */
347 } CkTextTabArray;
348
349 /*
350  * A data structure of the following type is kept for each text widget that
351  * currently exists for this process:
352  */
353
354 typedef struct CkText {
355     CkWindow *winPtr;           /* Window that embodies the text.  NULL
356                                  * means that the window has been destroyed
357                                  * but the data structures haven't yet been
358                                  * cleaned up.*/
359     Tcl_Interp *interp;         /* Interpreter associated with widget.  Used
360                                  * to delete widget command.  */
361     Tcl_Command widgetCmd;      /* Token for text's widget command. */
362     CkTextBTree tree;           /* B-tree representation of text and tags for
363                                  * widget. */
364     Tcl_HashTable tagTable;     /* Hash table that maps from tag names to
365                                  * pointers to CkTextTag structures. */
366     int numTags;                /* Number of tags currently defined for
367                                  * widget;  needed to keep track of
368                                  * priorities. */
369     Tcl_HashTable markTable;    /* Hash table that maps from mark names to
370                                  * pointers to mark segments. */
371     Tcl_HashTable windowTable;  /* Hash table that maps from window names
372                                  * to pointers to window segments.  If a
373                                  * window segment doesn't yet have an
374                                  * associated window, there is no entry for
375                                  * it here. */
376     Ck_Uid state;               /* Normal or disabled.  Text is read-only
377                                  * when disabled. */
378
379     /*
380      * Default information for displaying (may be overridden by tags
381      * applied to ranges of characters).
382      */
383
384     int bg, fg, attr;
385     char *tabOptionString;      /* Value of -tabs option string (malloc'ed). */
386     CkTextTabArray *tabArrayPtr;
387                                 /* Information about tab stops (malloc'ed).
388                                  * NULL means perform default tabbing
389                                  * behavior. */
390
391     /*
392      * Additional information used for displaying:
393      */
394
395     Ck_Uid wrapMode;            /* How to handle wrap-around.  Must be
396                                  * ckTextCharUid, ckTextNoneUid, or
397                                  * ckTextWordUid. */
398     int width, height;          /* Desired dimensions for window, measured
399                                  * in characters. */
400     int prevWidth, prevHeight;  /* Last known dimensions of window;  used to
401                                  * detect changes in size. */
402     CkTextIndex topIndex;       /* Identifies first character in top display
403                                  * line of window. */
404     struct DInfo *dInfoPtr;     /* Information maintained by ckTextDisp.c. */
405
406     /*
407      * Information related to selection.
408      */
409
410     int selFg, selBg, selAttr;
411     CkTextTag *selTagPtr;       /* Pointer to "sel" tag.  Used to tell when
412                                  * a new selection has been made. */
413     CkTextIndex selIndex;       /* Used during multi-pass selection retrievals.
414                                  * This index identifies the next character
415                                  * to be returned from the selection. */
416     int abortSelections;        /* Set to 1 whenever the text is modified
417                                  * in a way that interferes with selection
418                                  * retrieval:  used to abort incremental
419                                  * selection retrievals. */
420     int selOffset;              /* Offset in selection corresponding to
421                                  * selLine and selCh.  -1 means neither
422                                  * this information nor selIndex is of any
423                                  * use. */
424     int insertX, insertY;       /* Window coordinates of HW cursor. */
425
426     /*
427      * Information related to insertion cursor:
428      */
429
430     CkTextSegment *insertMarkPtr;
431                                 /* Points to segment for "insert" mark. */
432
433     /*
434      * Information used for event bindings associated with tags:
435      */
436
437     Ck_BindingTable bindingTable;
438                                 /* Table of all bindings currently defined
439                                  * for this widget.  NULL means that no
440                                  * bindings exist, so the table hasn't been
441                                  * created.  Each "object" used for this
442                                  * table is the address of a tag. */
443     CkTextSegment *currentMarkPtr;
444                                 /* Pointer to segment for "current" mark,
445                                  * or NULL if none. */
446     CkEvent pickEvent;          /* The event from which the current character
447                                  * was chosen.  Must be saved so that we
448                                  * can repick after modifications to the
449                                  * text. */
450     int numCurTags;             /* Number of tags associated with character
451                                  * at current mark. */
452     CkTextTag **curTagArrayPtr; /* Pointer to array of tags for current
453                                  * mark, or NULL if none. */
454
455     /*
456      * Miscellaneous additional information:
457      */
458
459     char *takeFocus;            /* Value of -takeFocus option;  not used in
460                                  * the C code, but used by keyboard traversal
461                                  * scripts.  Malloc'ed, but may be NULL. */
462     char *xScrollCmd;           /* Prefix of command to issue to update
463                                  * horizontal scrollbar when view changes. */
464     char *yScrollCmd;           /* Prefix of command to issue to update
465                                  * vertical scrollbar when view changes. */
466     int flags;                  /* Miscellaneous flags;  see below for
467                                  * definitions. */
468 } CkText;
469
470 /*
471  * Flag values for CkText records:
472  *
473  * GOT_SELECTION:               Non-zero means we've already claimed the
474  *                              selection.
475  * INSERT_ON:                   Non-zero means insertion cursor should be
476  *                              displayed on screen.
477  * GOT_FOCUS:                   Non-zero means this window has the input
478  *                              focus.
479  * UPDATE_SCROLLBARS:           Non-zero means scrollbar(s) should be updated
480  *                              during next redisplay operation.
481  */
482
483 #define GOT_SELECTION           1
484 #define INSERT_ON               2
485 #define GOT_FOCUS               4
486 #define UPDATE_SCROLLBARS       0x10
487 #define NEED_REPICK             0x20
488
489 /*
490  * Records of the following type define segment types in terms of
491  * a collection of procedures that may be called to manipulate
492  * segments of that type.
493  */
494
495 typedef CkTextSegment * Ck_SegSplitProc _ANSI_ARGS_((
496                             struct CkTextSegment *segPtr, int index));
497 typedef int             Ck_SegDeleteProc _ANSI_ARGS_((
498                             struct CkTextSegment *segPtr,
499                             CkTextLine *linePtr, int treeGone));
500 typedef CkTextSegment * Ck_SegCleanupProc _ANSI_ARGS_((
501                             struct CkTextSegment *segPtr, CkTextLine *linePtr));
502 typedef void            Ck_SegLineChangeProc _ANSI_ARGS_((
503                             struct CkTextSegment *segPtr, CkTextLine *linePtr));
504 typedef int             Ck_SegLayoutProc _ANSI_ARGS_((struct CkText *textPtr,
505                             struct CkTextIndex *indexPtr, CkTextSegment *segPtr,
506                             int offset, int maxX, int maxChars,
507                             int noCharsYet, Ck_Uid wrapMode,
508                             struct CkTextDispChunk *chunkPtr));
509 typedef void            Ck_SegCheckProc _ANSI_ARGS_((CkTextSegment *segPtr,
510                             CkTextLine *linePtr));
511
512 typedef struct Ck_SegType {
513     char *name;                         /* Name of this kind of segment. */
514     int leftGravity;                    /* If a segment has zero size (e.g. a
515                                          * mark or tag toggle), does it
516                                          * attach to character to its left
517                                          * or right?  1 means left, 0 means
518                                          * right. */
519     Ck_SegSplitProc *splitProc;         /* Procedure to split large segment
520                                          * into two smaller ones. */
521     Ck_SegDeleteProc *deleteProc;       /* Procedure to call to delete
522                                          * segment. */
523     Ck_SegCleanupProc *cleanupProc;     /* After any change to a line, this
524                                          * procedure is invoked for all
525                                          * segments left in the line to
526                                          * perform any cleanup they wish
527                                          * (e.g. joining neighboring
528                                          * segments). */
529     Ck_SegLineChangeProc *lineChangeProc;
530                                         /* Invoked when a segment is about
531                                          * to be moved from its current line
532                                          * to an earlier line because of
533                                          * a deletion.  The linePtr is that
534                                          * for the segment's old line.
535                                          * CleanupProc will be invoked after
536                                          * the deletion is finished. */
537     Ck_SegLayoutProc *layoutProc;       /* Returns size information when
538                                          * figuring out what to display in
539                                          * window. */
540     Ck_SegCheckProc *checkProc;         /* Called during consistency checks
541                                          * to check internal consistency of
542                                          * segment. */
543 } Ck_SegType;
544
545 /*
546  * The constant below is used to specify a line when what is really
547  * wanted is the entire text.  For now, just use a very big number.
548  */
549
550 #define TK_END_OF_TEXT 1000000
551
552 /*
553  * The following definition specifies the maximum number of characters
554  * needed in a string to hold a position specifier.
555  */
556
557 #define TK_POS_CHARS 30
558
559 /*
560  * Declarations for variables shared among the text-related files:
561  */
562
563 extern int              ckBTreeDebug;
564 extern int              ckTextDebug;
565 extern Ck_SegType       ckTextCharType;
566 extern Ck_Uid           ckTextCharUid;
567 extern Ck_Uid           ckTextDisabledUid;
568 extern Ck_SegType       ckTextLeftMarkType;
569 extern Ck_Uid           ckTextNoneUid;
570 extern Ck_Uid           ckTextNormalUid;
571 extern Ck_SegType       ckTextRightMarkType;
572 extern Ck_SegType       ckTextToggleOnType;
573 extern Ck_SegType       ckTextToggleOffType;
574 extern Ck_Uid           ckTextWordUid;
575
576 /*
577  * Declarations for procedures that are used by the text-related files
578  * but shouldn't be used anywhere else in Ck (or by Ck clients):
579  */
580
581 extern int              CkBTreeCharTagged _ANSI_ARGS_((CkTextIndex *indexPtr,
582                             CkTextTag *tagPtr));
583 extern void             CkBTreeCheck _ANSI_ARGS_((CkTextBTree tree));
584 extern int              CkBTreeCharsInLine _ANSI_ARGS_((CkTextLine *linePtr));
585 extern CkTextBTree      CkBTreeCreate _ANSI_ARGS_((void));
586 extern void             CkBTreeDestroy _ANSI_ARGS_((CkTextBTree tree));
587 extern void             CkBTreeDeleteChars _ANSI_ARGS_((CkTextIndex *index1Ptr,
588                             CkTextIndex *index2Ptr));
589 extern CkTextLine *     CkBTreeFindLine _ANSI_ARGS_((CkTextBTree tree,
590                             int line));
591 extern CkTextTag **     CkBTreeGetTags _ANSI_ARGS_((CkTextIndex *indexPtr,
592                             int *numTagsPtr));
593 extern void             CkBTreeInsertChars _ANSI_ARGS_((CkTextIndex *indexPtr,
594                             char *string));
595 extern int              CkBTreeLineIndex _ANSI_ARGS_((CkTextLine *linePtr));
596 extern void             CkBTreeLinkSegment _ANSI_ARGS_((CkTextSegment *segPtr,
597                             CkTextIndex *indexPtr));
598 extern CkTextLine *     CkBTreeNextLine _ANSI_ARGS_((CkTextLine *linePtr));
599 extern int              CkBTreeNextTag _ANSI_ARGS_((CkTextSearch *searchPtr));
600 extern int              CkBTreeNumLines _ANSI_ARGS_((CkTextBTree tree));
601 extern void             CkBTreeStartSearch _ANSI_ARGS_((CkTextIndex *index1Ptr,
602                             CkTextIndex *index2Ptr, CkTextTag *tagPtr,
603                             CkTextSearch *searchPtr));
604 extern void             CkBTreeTag _ANSI_ARGS_((CkTextIndex *index1Ptr,
605                             CkTextIndex *index2Ptr, CkTextTag *tagPtr,
606                             int add));
607 extern void             CkBTreeUnlinkSegment _ANSI_ARGS_((CkTextBTree tree,
608                             CkTextSegment *segPtr, CkTextLine *linePtr));
609 extern void             CkTextBindProc _ANSI_ARGS_((ClientData clientData,
610                             CkEvent *eventPtr));
611 extern void             CkTextChanged _ANSI_ARGS_((CkText *textPtr,
612                             CkTextIndex *index1Ptr, CkTextIndex *index2Ptr));
613 extern int              CkTextCharBbox _ANSI_ARGS_((CkText *textPtr,
614                             CkTextIndex *indexPtr, int *xPtr, int *yPtr,
615                             int *widthPtr, int *heightPtr));
616 extern int              CkTextCharLayoutProc _ANSI_ARGS_((CkText *textPtr,
617                             CkTextIndex *indexPtr, CkTextSegment *segPtr,
618                             int offset, int maxX, int maxChars, int noBreakYet,
619                             Ck_Uid wrapMode, CkTextDispChunk *chunkPtr));
620 extern void             CkTextCreateDInfo _ANSI_ARGS_((CkText *textPtr));
621 extern int              CkTextDLineInfo _ANSI_ARGS_((CkText *textPtr,
622                             CkTextIndex *indexPtr, int *xPtr, int *yPtr,
623                             int *widthPtr, int *heightPtr, int *basePtr));
624 extern CkTextTag *      CkTextCreateTag _ANSI_ARGS_((CkText *textPtr,
625                             char *tagName));
626 extern void             CkTextFreeDInfo _ANSI_ARGS_((CkText *textPtr));
627 extern void             CkTextFreeTag _ANSI_ARGS_((CkText *textPtr,
628                             CkTextTag *tagPtr));
629 extern int              CkTextGetIndex _ANSI_ARGS_((Tcl_Interp *interp,
630                             CkText *textPtr, char *string,
631                             CkTextIndex *indexPtr));
632 extern CkTextTabArray * CkTextGetTabs _ANSI_ARGS_((Tcl_Interp *interp,
633                             CkWindow *winPtr, char *string));
634 #if CK_USE_UTF
635 extern void             CkTextIndexBackBytes _ANSI_ARGS_((CkTextIndex *srcPtr,
636                             int count, CkTextIndex *dstPtr));
637 #endif
638 extern void             CkTextIndexBackChars _ANSI_ARGS_((CkTextIndex *srcPtr,
639                             int count, CkTextIndex *dstPtr));
640 extern int              CkTextIndexCmp _ANSI_ARGS_((CkTextIndex *index1Ptr,
641                             CkTextIndex *index2Ptr));
642 #if CK_USE_UTF
643 extern void             CkTextIndexForwBytes _ANSI_ARGS_((CkTextIndex *srcPtr,
644                             int count, CkTextIndex *dstPtr));
645 #endif
646 extern void             CkTextIndexForwChars _ANSI_ARGS_((CkTextIndex *srcPtr,
647                             int count, CkTextIndex *dstPtr));
648 extern CkTextSegment *  CkTextIndexToSeg _ANSI_ARGS_((CkTextIndex *indexPtr,
649                             int *offsetPtr));
650 extern void             CkTextInsertDisplayProc _ANSI_ARGS_((
651                             CkTextDispChunk *chunkPtr, int x, int y, int height,
652                             int baseline, WINDOW *window, int screenY));
653 extern void             CkTextLostSelection _ANSI_ARGS_((
654                             ClientData clientData));
655 #if CK_USE_UTF
656 extern CkTextIndex *    CkTextMakeByteIndex _ANSI_ARGS_((CkTextBTree tree,
657                             int lineIndex, int byteIndex,
658                             CkTextIndex *indexPtr));
659 #endif
660 extern CkTextIndex *    CkTextMakeIndex _ANSI_ARGS_((CkTextBTree tree,
661                             int lineIndex, int charIndex,
662                             CkTextIndex *indexPtr));
663 extern int              CkTextMarkCmd _ANSI_ARGS_((CkText *textPtr,
664                             Tcl_Interp *interp, int argc, char **argv));
665 extern int              CkTextMarkNameToIndex _ANSI_ARGS_((CkText *textPtr,
666                             char *name, CkTextIndex *indexPtr));
667 extern void             CkTextMarkSegToIndex _ANSI_ARGS_((CkText *textPtr,
668                             CkTextSegment *markPtr, CkTextIndex *indexPtr));
669 extern void             CkTextEventuallyRepick _ANSI_ARGS_((CkText *textPtr));
670 extern void             CkTextPickCurrent _ANSI_ARGS_((CkText *textPtr,
671                             CkEvent *eventPtr));
672 extern void             CkTextPixelIndex _ANSI_ARGS_((CkText *textPtr,
673                             int x, int y, CkTextIndex *indexPtr));
674 extern void             CkTextPrintIndex _ANSI_ARGS_((CkTextIndex *indexPtr,
675                             char *string));
676 extern void             CkTextRedrawRegion _ANSI_ARGS_((CkText *textPtr,
677                             int x, int y, int width, int height));
678 extern void             CkTextRedrawTag _ANSI_ARGS_((CkText *textPtr,
679                             CkTextIndex *index1Ptr, CkTextIndex *index2Ptr,
680                             CkTextTag *tagPtr, int withTag));
681 extern void             CkTextRelayoutWindow _ANSI_ARGS_((CkText *textPtr));
682 extern int              CkTextScanCmd _ANSI_ARGS_((CkText *textPtr,
683                             Tcl_Interp *interp, int argc, char **argv));
684 extern int              CkTextSeeCmd _ANSI_ARGS_((CkText *textPtr,
685                             Tcl_Interp *interp, int argc, char **argv));
686 extern int              CkTextSegToOffset _ANSI_ARGS_((CkTextSegment *segPtr,
687                             CkTextLine *linePtr));
688 extern CkTextSegment *  CkTextSetMark _ANSI_ARGS_((CkText *textPtr, char *name,
689                             CkTextIndex *indexPtr));
690 extern void             CkTextSetYView _ANSI_ARGS_((CkText *textPtr,
691                             CkTextIndex *indexPtr, int pickPlace));
692 extern int              CkTextTagCmd _ANSI_ARGS_((CkText *textPtr,
693                             Tcl_Interp *interp, int argc, char **argv));
694 extern int              CkTextWindowCmd _ANSI_ARGS_((CkText *textPtr,
695                             Tcl_Interp *interp, int argc, char **argv));
696 extern int              CkTextWindowIndex _ANSI_ARGS_((CkText *textPtr,
697                             char *name, CkTextIndex *indexPtr));
698 extern int              CkTextXviewCmd _ANSI_ARGS_((CkText *textPtr,
699                             Tcl_Interp *interp, int argc, char **argv));
700 extern int              CkTextYviewCmd _ANSI_ARGS_((CkText *textPtr,
701                             Tcl_Interp *interp, int argc, char **argv));
702
703 #endif /* _CKTEXT_H */