diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-02-02 15:26:18 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-02-02 15:26:18 (GMT) |
commit | 3213b080b096a2603f686f8bf239d886ee2fdace (patch) | |
tree | 6da61b569629623104e46687bb8426a8607a869c /generic | |
parent | db1813195a62a66315c34ba2b4a341f3efb331a9 (diff) | |
download | tk-3213b080b096a2603f686f8bf239d886ee2fdace.zip tk-3213b080b096a2603f686f8bf239d886ee2fdace.tar.gz tk-3213b080b096a2603f686f8bf239d886ee2fdace.tar.bz2 |
Get rid of underlineObj/overstrikgObj/elideObj int text tags
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkText.h | 15 | ||||
-rw-r--r-- | generic/tkTextBTree.c | 2 | ||||
-rw-r--r-- | generic/tkTextTag.c | 35 |
3 files changed, 22 insertions, 30 deletions
diff --git a/generic/tkText.h b/generic/tkText.h index c392e30..2227fd1 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -358,8 +358,9 @@ typedef struct TkTextTag { * baseline of line. Used for superscripts and * subscripts. Only valid if offsetString is * non-NULL. */ - Tcl_Obj *overstrikeObj; /* -overstrike option string (malloc-ed). NULL - * means option not specified. */ +#if TCL_MAJOR_VERSION < 9 + char *overstrikeString; /* (not used any more) */ +#endif int overstrike; /* > 0 means draw horizontal line through * middle of text. -1 means not specified. */ XColor *overstrikeColor; /* Color for the overstrike. NULL means same @@ -396,8 +397,9 @@ typedef struct TkTextTag { * NULL. Corresponds to tabString. */ int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR * or TK_TEXT_TABSTYLE_NULL (if not specified). */ - Tcl_Obj *underlineObj; /* -underline option. NULL - * means option not specified. */ +#if TCL_MAJOR_VERSION < 9 + char *underlineString; /* (not used any more) */ +#endif int underline; /* > 0 means draw underline underneath * text. -1 means not specified. */ XColor *underlineColor; /* Color for the underline. NULL means same @@ -407,8 +409,9 @@ typedef struct TkTextTag { * TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD, or * TEXT_WRAPMODE_NULL to use wrapmode for * whole widget. */ - Tcl_Obj *elideObj; /* -elide option. NULL - * means option not specified. */ +#if TCL_MAJOR_VERSION < 9 + char *elideString; /* (not used any more) */ +#endif int elide; /* > 0 means that data under this tag * should not be displayed. -1 means not specified. */ int affectsDisplay; /* Non-zero means that this tag affects the diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index b03b045..e609126 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -3616,7 +3616,7 @@ TkTextIsElided( summaryPtr = summaryPtr->nextPtr) { if (summaryPtr->toggleCount & 1) { tagPtr = summaryPtr->tagPtr; - if (tagPtr->elideObj != NULL) { + if (tagPtr->elide >= 0) { infoPtr->tagPtrs[tagPtr->priority] = tagPtr; infoPtr->tagCnts[tagPtr->priority] += summaryPtr->toggleCount; diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 5116254..377a00f 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -25,7 +25,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = { NULL, offsetof(TkTextTag, borderWidthPtr), offsetof(TkTextTag, borderWidth), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BOOLEAN, "-elide", NULL, NULL, - NULL, offsetof(TkTextTag, elideObj), offsetof(TkTextTag, elide), + NULL, TCL_INDEX_NONE, offsetof(TkTextTag, elide), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BITMAP, "-fgstipple", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0}, @@ -44,7 +44,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_STRING, "-offset", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL, - NULL, offsetof(TkTextTag, overstrikeObj), offsetof(TkTextTag, overstrike), + NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrike), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-overstrikefg", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeColor), @@ -71,7 +71,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = { NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tabStyle), TK_OPTION_NULL_OK, tkTextTabStyleStrings, 0}, {TK_OPTION_BOOLEAN, "-underline", NULL, NULL, - NULL, offsetof(TkTextTag, underlineObj), offsetof(TkTextTag, underline), + NULL, TCL_INDEX_NONE, offsetof(TkTextTag, underline), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-underlinefg", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, underlineColor), @@ -397,12 +397,6 @@ TkTextTagCmd( return TCL_ERROR; } } - if (tagPtr->overstrikeObj != NULL) { - if (Tcl_GetBoolean(interp, Tcl_GetString(tagPtr->overstrikeObj), - &tagPtr->overstrike) != TCL_OK) { - return TCL_ERROR; - } - } if (tagPtr->rMarginString != NULL) { if (Tk_GetPixels(interp, textPtr->tkwin, tagPtr->rMarginString, &tagPtr->rMargin) != TCL_OK) { @@ -447,18 +441,7 @@ TkTextTagCmd( return TCL_ERROR; } } - if (tagPtr->underlineObj != NULL) { - if (Tcl_GetBoolean(interp, Tcl_GetString(tagPtr->underlineObj), - &tagPtr->underline) != TCL_OK) { - return TCL_ERROR; - } - } if (tagPtr->elide >= 0) { - if (Tcl_GetBoolean(interp, Tcl_GetString(tagPtr->elideObj), - &tagPtr->elide) != TCL_OK) { - return TCL_ERROR; - } - /* * Indices are potentially obsolete after changing -elide, * especially those computed with "display" or "any" @@ -1024,7 +1007,9 @@ TkTextCreateTag( tagPtr->lMarginColor = NULL; tagPtr->offsetString = NULL; tagPtr->offset = 0; - tagPtr->overstrikeObj = NULL; +#if TCL_MAJOR_VERSION < 9 + tagPtr->overstrikeString = NULL; +#endif tagPtr->overstrike = -1; tagPtr->overstrikeColor = NULL; tagPtr->rMarginString = NULL; @@ -1041,10 +1026,14 @@ TkTextCreateTag( tagPtr->tabStringPtr = NULL; tagPtr->tabArrayPtr = NULL; tagPtr->tabStyle = TK_TEXT_TABSTYLE_NULL; - tagPtr->underlineObj = NULL; +#if TCL_MAJOR_VERSION < 9 + tagPtr->underlineString = NULL; +#endif tagPtr->underline = -1; tagPtr->underlineColor = NULL; - tagPtr->elideObj = NULL; +#if TCL_MAJOR_VERSION < 9 + tagPtr->elideString = NULL; +#endif tagPtr->elide = -1; tagPtr->wrapMode = TEXT_WRAPMODE_NULL; tagPtr->affectsDisplay = 0; |