Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tip-704 Excluding Merge-Ins
This is equivalent to a diff from 055d75f6 to 257f70b5
2024-11-25
| ||
11:41 | Fix [bcbf4c9875]: Tk intialization overwrites thread specific data check-in: 1793f638 user: jan.nijtmans tags: trunk, main | |
2024-11-17
| ||
01:33 | Merge trunk check-in: fdce0508 user: kevin_walzer tags: tka11y | |
2024-11-15
| ||
17:24 | Extend Tk_CanvasTextInfo (TIP still to be written) Leaf check-in: 257f70b5 user: jan.nijtmans tags: tip-704 | |
16:48 | Merge 9.0 check-in: 2de204a8 user: jan.nijtmans tags: revised_text, tip-466 | |
16:39 | Merge 9.0 check-in: bf7f5d6d user: jan.nijtmans tags: tip-626 | |
2024-11-14
| ||
22:36 | Make Tk_CanvasTextInfo and tkScrollbar.h usable for Tk 8.x-compiles too. See [22d2341c9d] check-in: 055d75f6 user: jan.nijtmans tags: trunk, main | |
22:28 | make tkDList.h equal to Tk 9.0 check-in: cfa6913c user: jan.nijtmans tags: core-8-branch | |
2024-11-13
| ||
14:33 | Fix [22d2341c9d]: Building extensions for Tk 8 and Tcl 8 in a Tcl 9 environment. Add a configure "--with-tk8" option check-in: e7540187 user: jan.nijtmans tags: trunk, main | |
Changes to doc/CanvTxtInfo.3.
︙ | ︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 | Tcl_Size \fIselectAnchor\fR; Tk_3DBorder \fIinsertBorder\fR; int \fIinsertWidth\fR; int \fIinsertBorderWidth\fR; Tk_Item *\fIfocusItemPtr\fR; int \fIgotFocus\fR; int \fIcursorOn\fR; } \fBTk_CanvasTextInfo\fR; .CE The \fBselBorder\fR field identifies a Tk_3DBorder that should be used for drawing the background under selected text. \fIselBorderWidth\fR gives the width of the raised border around | > > > | > > > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | Tcl_Size \fIselectAnchor\fR; Tk_3DBorder \fIinsertBorder\fR; int \fIinsertWidth\fR; int \fIinsertBorderWidth\fR; Tk_Item *\fIfocusItemPtr\fR; int \fIgotFocus\fR; int \fIcursorOn\fR; Tcl_Obj *\fIinsertBorderWidthObj\fR; Tcl_Obj *\fIinsertWidthObj\fR; Tcl_Obj *\fIselBorderWidthObj\fR; } \fBTk_CanvasTextInfo\fR; .CE The \fBselBorder\fR field identifies a Tk_3DBorder that should be used for drawing the background under selected text. \fIselBorderWidth\fR gives the width of the raised border around selected text, in pixels. \fIselBorderWidthObj\fR contains the same information, but the original Tcl_Obj * value; \fIselFgColorPtr\fR points to an XColor that describes the foreground color to be used when drawing selected text. \fIselItemPtr\fR points to the item that is currently selected, or NULL if there is no item selected or if the canvas does not have the selection. \fIselectFirst\fR and \fIselectLast\fR give the indices of the first and last selected characters in \fIselItemPtr\fR, as returned by the \fIindexProc\fR for that item. \fIanchorItemPtr\fR points to the item that currently has the selection anchor; this is not necessarily the same as \fIselItemPtr\fR. \fIselectAnchor\fR is an index that identifies the anchor position within \fIanchorItemPtr\fR. \fIinsertBorder\fR contains a Tk_3DBorder to use when drawing the insertion cursor; \fIinsertWidth\fR gives the total width of the insertion cursor in pixels, and \fIinsertBorderWidth\fR gives the width of the raised border around the insertion cursor. \fIinsertWidthObj\fR and \fIinsertBorderWidthObj\fR contain the same information, but the original Tcl_Obj * value. \fIfocusItemPtr\fR identifies the item that currently has the input focus, or NULL if there is no such item. \fIgotFocus\fR is 1 if the canvas widget has the input focus and 0 otherwise. \fIcursorOn\fR is 1 if the insertion cursor should be drawn in \fIfocusItemPtr\fR and 0 if it should not be drawn; this field is toggled on and off by Tk to make the cursor blink. |
︙ | ︙ |
Changes to generic/tk.h.
︙ | ︙ | |||
1151 1152 1153 1154 1155 1156 1157 | * NULL if no such item. Read-only to items. */ int gotFocus; /* Non-zero means that the canvas widget has * the input focus. Read-only to items.*/ int cursorOn; /* Non-zero means that an insertion cursor * should be displayed in focusItemPtr. * Read-only to items.*/ #if TK_MAJOR_VERSION > 8 | | | | | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 | * NULL if no such item. Read-only to items. */ int gotFocus; /* Non-zero means that the canvas widget has * the input focus. Read-only to items.*/ int cursorOn; /* Non-zero means that an insertion cursor * should be displayed in focusItemPtr. * Read-only to items.*/ #if TK_MAJOR_VERSION > 8 Tcl_Obj *insertBorderWidthObj; Tcl_Obj *insertWidthObj; Tcl_Obj *selBorderWidthObj; #endif } Tk_CanvasTextInfo; /* * Structures used for Dashing and Outline. */ |
︙ | ︙ |
Changes to generic/tkCanvText.c.
︙ | ︙ | |||
791 792 793 794 795 796 797 | /* * Last of all, update the bounding box for the item. The item's bounding * box includes the bounding box of all its lines, plus an extra fudge * factor for the cursor border (which could potentially be quite large). */ textInfoPtr = textPtr->textInfoPtr; | | | | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | /* * Last of all, update the bounding box for the item. The item's bounding * box includes the bounding box of all its lines, plus an extra fudge * factor for the cursor border (which could potentially be quite large). */ textInfoPtr = textPtr->textInfoPtr; Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->insertWidthObj, &textInfoPtr->insertWidth); Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->selBorderWidthObj, &textInfoPtr->selBorderWidth); fudge = (textInfoPtr->insertWidth + 1) / 2; if (textInfoPtr->selBorderWidth > fudge) { fudge = textInfoPtr->selBorderWidth; } /* * Apply the rotation before computing the bounding box. |
︙ | ︙ | |||
942 943 944 945 946 947 948 | * selection background all the way to the end of the line. * However, for the last line we only want to display up to the * last character, not the end of the line. */ x = xFirst; height = hFirst; | | | 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 | * selection background all the way to the end of the line. * However, for the last line we only want to display up to the * last character, not the end of the line. */ x = xFirst; height = hFirst; Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->selBorderWidthObj, &textInfoPtr->selBorderWidth); for (y = yFirst ; y <= yLast; y += height) { int dx1, dy1, dx2, dy2; double s = textPtr->sine, c = textPtr->cosine; XPoint points[4]; if (y == yLast) { width = xLast + wLast - x; |
︙ | ︙ | |||
989 990 991 992 993 994 995 | if ((textInfoPtr->focusItemPtr == itemPtr) && (textInfoPtr->gotFocus)) { if (Tk_CharBbox(textPtr->textLayout, textPtr->insertPos, &x, &y, NULL, &height)) { int dx1, dy1, dx2, dy2; double s = textPtr->sine, c = textPtr->cosine; XPoint points[4]; | | | | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | if ((textInfoPtr->focusItemPtr == itemPtr) && (textInfoPtr->gotFocus)) { if (Tk_CharBbox(textPtr->textLayout, textPtr->insertPos, &x, &y, NULL, &height)) { int dx1, dy1, dx2, dy2; double s = textPtr->sine, c = textPtr->cosine; XPoint points[4]; Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->insertWidthObj, &textInfoPtr->insertWidth); dx1 = x - (textInfoPtr->insertWidth / 2); dy1 = y; dx2 = textInfoPtr->insertWidth; dy2 = height; points[0].x = (short)(drawableX + dx1*c + dy1*s); points[0].y = (short)(drawableY + dy1*c - dx1*s); points[1].x = (short)(drawableX + (dx1+dx2)*c + dy1*s); points[1].y = (short)(drawableY + dy1*c - (dx1+dx2)*s); points[2].x = (short)(drawableX + (dx1+dx2)*c + (dy1+dy2)*s); points[2].y = (short)(drawableY + (dy1+dy2)*c - (dx1+dx2)*s); points[3].x = (short)(drawableX + dx1*c + (dy1+dy2)*s); points[3].y = (short)(drawableY + (dy1+dy2)*c - dx1*s); Tk_SetCaretPos(Tk_CanvasTkwin(canvas), points[0].x, points[0].y, height); if (textInfoPtr->cursorOn) { Tk_GetPixelsFromObj(NULL, Tk_CanvasTkwin(canvas), textInfoPtr->insertBorderWidthObj, &textInfoPtr->insertBorderWidth); Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable, textInfoPtr->insertBorder, points, 4, textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED); } else if (textPtr->cursorOffGC != NULL) { /* * Redraw the background over the area of the cursor, even * though the cursor is turned off. This guarantees that the |
︙ | ︙ |
Changes to generic/tkCanvas.c.
︙ | ︙ | |||
117 118 119 120 121 122 123 | DEF_CANVAS_HIGHLIGHT, offsetof(TkCanvas, highlightColorPtr), 0, NULL}, {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_CANVAS_HIGHLIGHT_WIDTH, offsetof(TkCanvas, highlightWidthObj), TK_CONFIG_OBJS, NULL}, {TK_CONFIG_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_CANVAS_INSERT_BG, offsetof(TkCanvas, textInfo.insertBorder), 0, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", | | | | | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | DEF_CANVAS_HIGHLIGHT, offsetof(TkCanvas, highlightColorPtr), 0, NULL}, {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_CANVAS_HIGHLIGHT_WIDTH, offsetof(TkCanvas, highlightWidthObj), TK_CONFIG_OBJS, NULL}, {TK_CONFIG_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_CANVAS_INSERT_BG, offsetof(TkCanvas, textInfo.insertBorder), 0, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_CANVAS_INSERT_BD_COLOR, offsetof(TkCanvas, textInfo.insertBorderWidthObj), TK_CONFIG_OBJS|TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_CANVAS_INSERT_BD_MONO, offsetof(TkCanvas, textInfo.insertBorderWidthObj), TK_CONFIG_OBJS|TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_CANVAS_INSERT_OFF_TIME, offsetof(TkCanvas, insertOffTime), 0, NULL}, {TK_CONFIG_INT, "-insertontime", "insertOnTime", "OnTime", DEF_CANVAS_INSERT_ON_TIME, offsetof(TkCanvas, insertOnTime), 0, NULL}, {TK_CONFIG_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_CANVAS_INSERT_WIDTH, offsetof(TkCanvas, textInfo.insertWidthObj), TK_CONFIG_OBJS, NULL}, {TK_CONFIG_CUSTOM, "-offset", "offset", "Offset", "0,0", offsetof(TkCanvas, tsoffset),TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_RELIEF, "-relief", "relief", "Relief", DEF_CANVAS_RELIEF, offsetof(TkCanvas, relief), 0, NULL}, {TK_CONFIG_STRING, "-scrollregion", "scrollRegion", "ScrollRegion", DEF_CANVAS_SCROLL_REGION, offsetof(TkCanvas, regionObj), TK_CONFIG_OBJS|TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_CANVAS_SELECT_COLOR, offsetof(TkCanvas, textInfo.selBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_CANVAS_SELECT_MONO, offsetof(TkCanvas, textInfo.selBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_CANVAS_SELECT_BD_COLOR, offsetof(TkCanvas, textInfo.selBorderWidthObj), TK_CONFIG_OBJS|TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_CANVAS_SELECT_BD_MONO, offsetof(TkCanvas, textInfo.selBorderWidthObj), TK_CONFIG_OBJS|TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_CANVAS_SELECT_FG_COLOR, offsetof(TkCanvas, textInfo.selFgColorPtr), TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_CANVAS_SELECT_FG_MONO, offsetof(TkCanvas, textInfo.selFgColorPtr), TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK, NULL}, |
︙ | ︙ | |||
687 688 689 690 691 692 693 | canvasPtr->inset = 0; canvasPtr->pixmapGC = NULL; canvasPtr->widthObj = NULL; canvasPtr->heightObj = NULL; canvasPtr->confine = 0; canvasPtr->textInfo.selBorder = NULL; canvasPtr->textInfo.selBorderWidth = 0; | | | | | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | canvasPtr->inset = 0; canvasPtr->pixmapGC = NULL; canvasPtr->widthObj = NULL; canvasPtr->heightObj = NULL; canvasPtr->confine = 0; canvasPtr->textInfo.selBorder = NULL; canvasPtr->textInfo.selBorderWidth = 0; canvasPtr->textInfo.selBorderWidthObj = NULL; canvasPtr->textInfo.selFgColorPtr = NULL; canvasPtr->textInfo.selItemPtr = NULL; canvasPtr->textInfo.selectFirst = TCL_INDEX_NONE; canvasPtr->textInfo.selectLast = TCL_INDEX_NONE; canvasPtr->textInfo.anchorItemPtr = NULL; canvasPtr->textInfo.selectAnchor = 0; canvasPtr->textInfo.insertBorder = NULL; canvasPtr->textInfo.insertWidth = 0; canvasPtr->textInfo.insertWidthObj = NULL; canvasPtr->textInfo.insertBorderWidth = 0; canvasPtr->textInfo.insertBorderWidthObj = NULL; canvasPtr->textInfo.focusItemPtr = NULL; canvasPtr->textInfo.gotFocus = 0; canvasPtr->textInfo.cursorOn = 0; canvasPtr->insertOnTime = 0; canvasPtr->insertOffTime = 0; canvasPtr->insertBlinkHandler = NULL; canvasPtr->xOrigin = canvasPtr->yOrigin = 0; |
︙ | ︙ | |||
2283 2284 2285 2286 2287 2288 2289 | */ Tk_SetBackgroundFromBorder(canvasPtr->tkwin, canvasPtr->bgBorder); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->heightObj, &height); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->highlightWidthObj, &highlightWidth); | | | | | 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 | */ Tk_SetBackgroundFromBorder(canvasPtr->tkwin, canvasPtr->bgBorder); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->heightObj, &height); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->highlightWidthObj, &highlightWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.insertBorderWidthObj, &canvasPtr->textInfo.insertBorderWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.insertWidthObj, &canvasPtr->textInfo.insertWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.selBorderWidthObj, &canvasPtr->textInfo.selBorderWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->widthObj, &width); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->xScrollIncrementObj, &xScrollIncrement); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->yScrollIncrementObj, &yScrollIncrement); if (borderWidth < 0) { borderWidth = 0; Tcl_DecrRefCount(canvasPtr->borderWidthObj); canvasPtr->borderWidthObj = Tcl_NewIntObj(0); |
︙ | ︙ | |||
2328 2329 2330 2331 2332 2333 2334 | Tcl_DecrRefCount(canvasPtr->yScrollIncrementObj); canvasPtr->yScrollIncrementObj = Tcl_NewIntObj(0); Tcl_IncrRefCount(canvasPtr->yScrollIncrementObj); } canvasPtr->inset = borderWidth + highlightWidth; if (canvasPtr->textInfo.insertBorderWidth < 0) { canvasPtr->textInfo.insertBorderWidth = 0; | | | | | | | | | | | 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 | Tcl_DecrRefCount(canvasPtr->yScrollIncrementObj); canvasPtr->yScrollIncrementObj = Tcl_NewIntObj(0); Tcl_IncrRefCount(canvasPtr->yScrollIncrementObj); } canvasPtr->inset = borderWidth + highlightWidth; if (canvasPtr->textInfo.insertBorderWidth < 0) { canvasPtr->textInfo.insertBorderWidth = 0; Tcl_DecrRefCount(canvasPtr->textInfo.insertBorderWidthObj); canvasPtr->textInfo.insertBorderWidthObj = Tcl_NewIntObj(0); Tcl_IncrRefCount(canvasPtr->textInfo.insertBorderWidthObj); } if (canvasPtr->textInfo.insertWidth < 0) { canvasPtr->textInfo.insertWidth = 0; Tcl_DecrRefCount(canvasPtr->textInfo.insertWidthObj); canvasPtr->textInfo.insertWidthObj = Tcl_NewIntObj(0); Tcl_IncrRefCount(canvasPtr->textInfo.insertWidthObj); } if (canvasPtr->textInfo.selBorderWidth < 0) { canvasPtr->textInfo.selBorderWidth = 0; Tcl_DecrRefCount(canvasPtr->textInfo.selBorderWidthObj); canvasPtr->textInfo.selBorderWidthObj = Tcl_NewIntObj(0); Tcl_IncrRefCount(canvasPtr->textInfo.selBorderWidthObj); } gcValues.function = GXcopy; gcValues.graphics_exposures = False; gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel; newGC = Tk_GetGC(canvasPtr->tkwin, GCFunction|GCGraphicsExposures|GCForeground, &gcValues); |
︙ | ︙ | |||
2488 2489 2490 2491 2492 2493 2494 | static void CanvasWorldChanged( void *instanceData) /* Information about widget. */ { TkCanvas *canvasPtr = (TkCanvas *)instanceData; Tk_Item *itemPtr; | | | | | 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 | static void CanvasWorldChanged( void *instanceData) /* Information about widget. */ { TkCanvas *canvasPtr = (TkCanvas *)instanceData; Tk_Item *itemPtr; Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.insertBorderWidthObj, &canvasPtr->textInfo.insertBorderWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.insertWidthObj, &canvasPtr->textInfo.insertWidth); Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->textInfo.selBorderWidthObj, &canvasPtr->textInfo.selBorderWidth); itemPtr = canvasPtr->firstItemPtr; for ( ; itemPtr != NULL; itemPtr = itemPtr->nextPtr) { if (ItemConfigure(canvasPtr, itemPtr, 0, NULL) != TCL_OK) { Tcl_ResetResult(canvasPtr->interp); } } |
︙ | ︙ |