diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-13 10:09:58 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-13 10:09:58 (GMT) |
commit | c253a25bf983c9a6f1ac39689d16b886fbbde7bf (patch) | |
tree | 04d4d861caa4e4dc9dbe83d3ea6b1cc5b5c54aea /generic | |
parent | e2d41cd9d979b5877eba4870b5e20df072050acc (diff) | |
download | tk-c253a25bf983c9a6f1ac39689d16b886fbbde7bf.zip tk-c253a25bf983c9a6f1ac39689d16b886fbbde7bf.tar.gz tk-c253a25bf983c9a6f1ac39689d16b886fbbde7bf.tar.bz2 |
Fix Tk_CharBbox/Tk_DrawTextLayout signature (int -> Tcl_Size). Update documentation.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.decls | 4 | ||||
-rw-r--r-- | generic/tkDecls.h | 8 | ||||
-rw-r--r-- | generic/tkFont.c | 30 | ||||
-rw-r--r-- | generic/tkInt.decls | 4 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 5 | ||||
-rw-r--r-- | generic/tkText.c | 9 | ||||
-rw-r--r-- | generic/tkText.h | 6 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 7 | ||||
-rw-r--r-- | generic/tkTextIndex.c | 2 |
9 files changed, 40 insertions, 35 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index ae693d3..d1b5ffb 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -120,7 +120,7 @@ declare 22 { XSetWindowAttributes *attsPtr) } declare 23 { - int Tk_CharBbox(Tk_TextLayout layout, int index, int *xPtr, + int Tk_CharBbox(Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr) } declare 24 { @@ -272,7 +272,7 @@ declare 60 { declare 61 { void Tk_DrawTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, - int x, int y, int firstChar, int lastChar) + int x, int y, Tcl_Size firstChar, Tcl_Size lastChar) } declare 62 { void Tk_Fill3DPolygon(Tk_Window tkwin, diff --git a/generic/tkDecls.h b/generic/tkDecls.h index cb39e7b..5a6b81a 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -118,7 +118,7 @@ EXTERN void Tk_ChangeWindowAttributes(Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 23 */ -EXTERN int Tk_CharBbox(Tk_TextLayout layout, int index, +EXTERN int Tk_CharBbox(Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 24 */ @@ -248,7 +248,7 @@ EXTERN void Tk_DrawFocusHighlight(Tk_Window tkwin, GC gc, EXTERN void Tk_DrawTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, - int firstChar, int lastChar); + Tcl_Size firstChar, Tcl_Size lastChar); /* 62 */ EXTERN void Tk_Fill3DPolygon(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, @@ -922,7 +922,7 @@ typedef struct TkStubs { Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */ void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr); /* 21 */ void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 22 */ - int (*tk_CharBbox) (Tk_TextLayout layout, int index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 23 */ + int (*tk_CharBbox) (Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 23 */ void (*tk_ClearSelection) (Tk_Window tkwin, Atom selection); /* 24 */ int (*tk_ClipboardAppend) (Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, const char *buffer); /* 25 */ int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */ @@ -960,7 +960,7 @@ typedef struct TkStubs { void (*tk_Draw3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 58 */ void (*tk_DrawChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, int x, int y); /* 59 */ void (*tk_DrawFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable); /* 60 */ - void (*tk_DrawTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int firstChar, int lastChar); /* 61 */ + void (*tk_DrawTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, Tcl_Size firstChar, Tcl_Size lastChar); /* 61 */ void (*tk_Fill3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, Tcl_Size numPoints, int borderWidth, int leftRelief); /* 62 */ void (*tk_Fill3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 63 */ Tk_PhotoHandle (*tk_FindPhoto) (Tcl_Interp *interp, const char *imageName); /* 64 */ diff --git a/generic/tkFont.c b/generic/tkFont.c index e67be4e..384119c 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -73,9 +73,9 @@ typedef struct LayoutChunk { const char *start; /* Pointer to simple string to be displayed. * This is a pointer into the TkTextLayout's * string. */ - int numBytes; /* The number of bytes in this chunk. */ - int numChars; /* The number of characters in this chunk. */ - int numDisplayChars; /* The number of characters to display when + Tcl_Size numBytes; /* The number of bytes in this chunk. */ + Tcl_Size numChars; /* The number of characters in this chunk. */ + Tcl_Size numDisplayChars; /* The number of characters to display when * this chunk is displayed. Can be less than * numChars if extra space characters were * absorbed by the end of the chunk. This will @@ -98,7 +98,7 @@ typedef struct TextLayout { const char *string; /* The string that was layed out. */ int width; /* The maximum width of all lines in the text * layout. */ - int numChunks; /* Number of chunks actually used in following + Tcl_Size numChunks; /* Number of chunks actually used in following * array. */ LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be * maxChunks. THIS FIELD MUST BE THE LAST IN @@ -337,7 +337,7 @@ static void FreeFontObjProc(Tcl_Obj *objPtr); static int GetAttributeInfoObj(Tcl_Interp *interp, const TkFontAttributes *faPtr, Tcl_Obj *objPtr); static LayoutChunk * NewChunk(TextLayout **layoutPtrPtr, int *maxPtr, - const char *start, int numChars, int curX, + const char *start, Tcl_Size numChars, int curX, int newX, int y); static int ParseFontNameObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, TkFontAttributes *faPtr); @@ -1987,7 +1987,8 @@ Tk_ComputeTextLayout( { TkFont *fontPtr = (TkFont *) tkfont; const char *start, *endp, *special; - int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight; + Tcl_Size n; + int y, bytesThisChunk, maxChunks, curLine, layoutHeight; int baseline, height, curX, newX, maxWidth, *lineLengths; TextLayout *layoutPtr; LayoutChunk *chunkPtr; @@ -2310,10 +2311,10 @@ Tk_DrawTextLayout( * Tk_ComputeTextLayout(). */ int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ - int firstChar, /* The index of the first character to draw + Tcl_Size firstChar, /* The index of the first character to draw * from the given text item. 0 specifies the * beginning. */ - int lastChar) /* The index just after the last character to + Tcl_Size lastChar) /* The index just after the last character to * draw from the given text item. A number < 0 * means to draw all characters. */ { @@ -2322,7 +2323,8 @@ Tk_DrawTextLayout( TkDrawAngledTextLayout(display, drawable, gc, layout, x, y, 0.0, firstChar, lastChar); #else TextLayout *layoutPtr = (TextLayout *) layout; - int i, numDisplayChars, drawX; + int i, drawX; + Tcl_Size numDisplayChars; const char *firstByte, *lastByte; LayoutChunk *chunkPtr; @@ -2381,10 +2383,10 @@ TkDrawAngledTextLayout( int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ double angle, - int firstChar, /* The index of the first character to draw + Tcl_Size firstChar, /* The index of the first character to draw * from the given text item. 0 specifies the * beginning. */ - int lastChar) /* The index just after the last character to + Tcl_Size lastChar) /* The index just after the last character to * draw from the given text item. A number < 0 * means to draw all characters. */ { @@ -2743,7 +2745,7 @@ int Tk_CharBbox( Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ - int index, /* The index of the character whose bbox is + Tcl_Size index, /* The index of the character whose bbox is * desired. Negative means count backwards. */ int *xPtr, int *yPtr, /* Filled with the upper-left hand corner, in * pixels, of the bounding box for the @@ -3836,7 +3838,7 @@ NewChunk( TextLayout **layoutPtrPtr, int *maxPtr, const char *start, - int numBytes, + Tcl_Size numBytes, int curX, int newX, int y) @@ -4358,7 +4360,7 @@ TkFontGetFirstTextLayout( { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr; - int numBytesInChunk; + Tcl_Size numBytesInChunk; if ((layoutPtr == NULL) || (layoutPtr->numChunks == 0) || (layoutPtr->chunks->numDisplayChars <= 0)) { diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 1f465ca..e6db14e 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -581,8 +581,8 @@ declare 180 { # Angled text API, exposed for Emiliano Gavilán's RBC work. declare 181 { void TkDrawAngledTextLayout(Display *display, Drawable drawable, GC gc, - Tk_TextLayout layout, int x, int y, double angle, int firstChar, - int lastChar) + Tk_TextLayout layout, int x, int y, double angle, Tcl_Size firstChar, + Tcl_Size lastChar) } declare 182 { void TkUnderlineAngledTextLayout(Display *display, Drawable drawable, diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index a1cd4ae..42c679f 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -520,7 +520,8 @@ EXTERN const char * TkSmoothPrintProc(void *clientData, Tk_Window tkwin, EXTERN void TkDrawAngledTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, - double angle, int firstChar, int lastChar); + double angle, Tcl_Size firstChar, + Tcl_Size lastChar); /* 182 */ EXTERN void TkUnderlineAngledTextLayout(Display *display, Drawable drawable, GC gc, @@ -729,7 +730,7 @@ typedef struct TkIntStubs { const char * (*tkOrientPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 178 */ int (*tkSmoothParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 179 */ const char * (*tkSmoothPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 180 */ - void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); /* 181 */ + void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, Tcl_Size firstChar, Tcl_Size lastChar); /* 181 */ void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */ int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */ void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, double x, double y, double angle); /* 184 */ diff --git a/generic/tkText.c b/generic/tkText.c index ff58398..9421f35 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -1417,7 +1417,8 @@ TextWidgetObjCmd( goto done; } if (textPtr->state == TK_TEXT_STATE_NORMAL) { - int lineNum, byteIndex; + int lineNum; + Tcl_Size byteIndex; TkTextIndex index; /* @@ -3229,7 +3230,7 @@ DeleteIndexRange( } for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { int line = 0; - int byteIndex = 0; + Tcl_Size byteIndex = 0; int resetView = 0; if (TkTextIndexCmp(&index2, &tPtr->topIndex) >= 0) { @@ -3314,10 +3315,10 @@ DeleteIndexRange( resetViewCount = 0; for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { - int line = lineAndByteIndex[resetViewCount]; + Tcl_Size line = lineAndByteIndex[resetViewCount]; if (line != -1) { - int byteIndex = lineAndByteIndex[resetViewCount+1]; + Tcl_Size byteIndex = lineAndByteIndex[resetViewCount+1]; TkTextIndex indexTmp; if (tPtr == textPtr) { diff --git a/generic/tkText.h b/generic/tkText.h index 22e45b5..81b925b 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -190,7 +190,7 @@ typedef struct TkTextIndex { TkTextBTree tree; /* Tree containing desired position. */ TkTextLine *linePtr; /* Pointer to line containing position of * interest. */ - int byteIndex; /* Index within line of desired character (0 + Tcl_Size byteIndex; /* Index within line of desired character (0 * means first one). */ struct TkText *textPtr; /* May be NULL, but otherwise the text widget * with which this index is associated. If not @@ -255,7 +255,7 @@ struct TkTextDispChunk { * x-location. */ Tk_ChunkBboxProc *bboxProc; /* Procedure to find bounding box of character * in chunk. */ - int numBytes; /* Number of bytes that will be displayed in + Tcl_Size numBytes; /* Number of bytes that will be displayed in * the chunk. */ int minAscent; /* Minimum space above the baseline needed by * this chunk. */ @@ -267,7 +267,7 @@ struct TkTextDispChunk { * set by chunk-specific code, but may be * increased to include tab or extra space at * end of line. */ - int breakIndex; /* Index within chunk of last acceptable + Tcl_Size breakIndex; /* Index within chunk of last acceptable * position for a line (break just before this * byte index). <= 0 means don't break during * or immediately after this chunk. */ diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 5ad4509..11ceb59 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -440,7 +440,7 @@ typedef struct TextDInfo { #ifndef TK_LAYOUT_WITH_BASE_CHUNKS typedef struct CharInfo { - int numBytes; /* Number of bytes to display. */ + Tcl_Size numBytes; /* Number of bytes to display. */ char chars[TKFLEXARRAY]; /* UTF characters to display. * Allocated as large as necessary. THIS MUST BE THE LAST * FIELD IN THE STRUCTURE. */ @@ -452,7 +452,7 @@ typedef struct CharInfo { TkTextDispChunk *baseChunkPtr; int baseOffset; /* Starting offset in base chunk * baseChars. */ - int numBytes; /* Number of bytes that belong to this + Tcl_Size numBytes; /* Number of bytes that belong to this * chunk. */ const char *chars; /* UTF characters to display. Actually points * into the baseChars of the base chunk. Only @@ -7989,7 +7989,8 @@ CharDisplayProc( const char *string; TextStyle *stylePtr; StyleValues *sValuePtr; - int numBytes, offsetBytes, offsetX; + Tcl_Size numBytes, offsetBytes; + int offsetX; #ifdef TK_DRAW_IN_CONTEXT BaseCharInfo *bciPtr; #endif /* TK_DRAW_IN_CONTEXT */ diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index b0a5c94..14e9106 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -1109,7 +1109,7 @@ TkTextPrintIndex( { TkTextSegment *segPtr; TkTextLine *linePtr; - int numBytes, charIndex; + Tcl_Size numBytes, charIndex; numBytes = indexPtr->byteIndex; charIndex = 0; |