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