summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkSquare.c14
-rw-r--r--generic/tkText.c2
-rw-r--r--generic/tkText.h66
-rw-r--r--generic/tkTextTag.c15
-rw-r--r--tests/textTag.test8
5 files changed, 72 insertions, 33 deletions
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index b459148..71b0267 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -53,7 +53,7 @@ typedef struct {
Tcl_Obj *reliefPtr;
GC gc; /* Graphics context for copying from
* off-screen pixmap onto screen. */
- Tcl_Obj *doubleBufferPtr; /* Non-zero means double-buffer redisplay with
+ int doubleBuffer; /* Non-zero means double-buffer redisplay with
* pixmap; zero means draw straight onto the
* display. */
int updatePending; /* Non-zero means a call to SquareDisplay has
@@ -75,7 +75,7 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
"2", offsetof(Square, borderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0},
{TK_OPTION_BOOLEAN, "-dbl", "doubleBuffer", "DoubleBuffer",
- "1", offsetof(Square, doubleBufferPtr), TCL_INDEX_NONE, 0 , NULL, 0},
+ "1", TCL_INDEX_NONE, offsetof(Square, doubleBuffer), 0 , NULL, 0},
{TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
"-foreground", 0},
{TK_OPTION_BORDER, "-foreground", "foreground", "Foreground",
@@ -322,7 +322,6 @@ SquareConfigure(
{
int borderWidth;
Tk_3DBorder bgBorder;
- int doubleBuffer;
/*
* Set the background for the window and create a graphics context for use
@@ -333,8 +332,7 @@ SquareConfigure(
squarePtr->bgBorderPtr);
Tk_SetWindowBackground(squarePtr->tkwin,
Tk_3DBorderColor(bgBorder)->pixel);
- Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer);
- if ((squarePtr->gc == NULL) && doubleBuffer) {
+ if ((squarePtr->gc == NULL) && squarePtr->doubleBuffer) {
XGCValues gcValues;
gcValues.function = GXcopy;
gcValues.graphics_exposures = False;
@@ -478,7 +476,6 @@ SquareDisplay(
Drawable d;
int borderWidth, size, relief;
Tk_3DBorder bgBorder, fgBorder;
- int doubleBuffer;
squarePtr->updatePending = 0;
if (!Tk_IsMapped(tkwin)) {
@@ -489,8 +486,7 @@ SquareDisplay(
* Create a pixmap for double-buffering, if necessary.
*/
- Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer);
- if (doubleBuffer) {
+ if (squarePtr->doubleBuffer) {
pm = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
Tk_Width(tkwin), Tk_Height(tkwin),
DefaultDepthOfScreen(Tk_Screen(tkwin)));
@@ -525,7 +521,7 @@ SquareDisplay(
* If double-buffered, copy to the screen and release the pixmap.
*/
- if (doubleBuffer) {
+ if (squarePtr->doubleBuffer) {
XCopyArea(Tk_Display(tkwin), pm, Tk_WindowId(tkwin), squarePtr->gc,
0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
0, 0);
diff --git a/generic/tkText.c b/generic/tkText.c
index 78fe385..ce39e0d 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -618,8 +618,6 @@ CreateWidget(
textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL);
Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief);
- textPtr->selTagPtr->reliefObj = Tcl_NewStringObj(DEF_TEXT_SELECT_RELIEF, -1);
- Tcl_IncrRefCount(textPtr->selTagPtr->reliefObj);
textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &startIndex);
textPtr->insertMarkPtr = TkTextSetMark(textPtr, "insert", &startIndex);
diff --git a/generic/tkText.h b/generic/tkText.h
index 46d837d..5578341 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -342,7 +342,10 @@ typedef struct TkTextTag {
* value specified here. */
int borderWidth; /* Width of 3-D border for background. */
Tcl_Obj *borderWidthPtr; /* Width of 3-D border for background. */
- Tcl_Obj *reliefObj;
+#if TK_MAJOR_VERSION < 9
+ char *reliefString; /* -relief option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
int relief; /* 3-D relief for background. */
Pixmap bgStipple; /* Stipple bitmap for background. None means
* no value specified here. */
@@ -353,32 +356,57 @@ typedef struct TkTextTag {
Pixmap fgStipple; /* Stipple bitmap for text and other
* foreground stuff. None means no value
* specified here.*/
- Tcl_Obj *justifyObj;
- Tk_Justify justify; /* How to justify text: TK_JUSTIFY_LEFT,
- * TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER, or TK_JUSTIFY_NULL. */
+#if TK_MAJOR_VERSION < 9
+ char *justifyString; /* -justify option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
+ Tk_Justify justify; /* How to justify text: TK_JUSTIFY_CENTER,
+ * TK_JUSTIFY_LEFT, or TK_JUSTIFY_RIGHT. */
+#if TK_MAJOR_VERSION > 8
Tcl_Obj *lMargin1Obj; /* -lmargin1 option object. NULL
* means option not specified. */
+#else
+ char *lMargin1String; /* -lmargin1 option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
int lMargin1; /* Left margin for first display line of each
* text line, in pixels. INT_MIN means option not specified. */
+#if TK_MAJOR_VERSION > 8
Tcl_Obj *lMargin2Obj; /* -lmargin2 option object. NULL
* means option not specified. */
+#else
+ char *lMargin2String; /* -lmargin2 option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
int lMargin2; /* Left margin for second and later display lines
- * of each text line, in pixels. */
+ * of each text line, in pixels. INT_MIN means option not specified. */
Tk_3DBorder lMarginColor; /* Used for drawing background in left margins.
* This is used for both lmargin1 and lmargin2.
* NULL means no value specified here. */
+#if TK_MAJOR_VERSION > 8
Tcl_Obj *offsetObj; /* -offset option. NULL means option not specified. */
+#else
+ char *offsetString; /* -offset option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
int offset; /* Vertical offset of text's baseline from
* baseline of line. Used for superscripts and
* subscripts. INT_MIN means option not specified. */
- Tcl_Obj *overstrikePtr; /* -overstrike option. NULL
+#if TK_MAJOR_VERSION < 9
+ char *overstrikeString; /* -overstrike option string (malloc-ed). NULL
* means option not specified. */
+#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
* color as foreground. */
+#if TK_MAJOR_VERSION > 8
Tcl_Obj *rMarginObj; /* -rmargin option object. NULL
* means option not specified. */
+#else
+ char *rMarginString; /* -rmargin option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
int rMargin; /* Right margin for text, in pixels. INT_MIN means option not specified. */
Tk_3DBorder rMarginColor; /* Used for drawing background in right margin.
* NULL means no value specified here. */
@@ -386,16 +414,31 @@ typedef struct TkTextTag {
* NULL means no value specified here. */
XColor *selFgColor; /* Foreground color for selected text. NULL means
* no value specified here. */
+#if TK_MAJOR_VERSION > 8
Tcl_Obj *spacing1Obj; /* -spacing1 option object. NULL
* means option not specified. */
+#else
+ char *spacing1String; /* -spacing1 option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
int spacing1; /* Extra spacing above first display line for
* text line. INT_MIN means option not specified. */
+#if TK_MAJOR_VERSION > 8
Tcl_Obj *spacing2Obj; /* -spacing2 option object. NULL
* means option not specified. */
+#else
+ char *spacing2String; /* -spacing2 option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
int spacing2; /* Extra spacing between display lines for the
* same text line. INT_MIN means option not specified. */
+#if TK_MAJOR_VERSION > 8
Tcl_Obj *spacing3Obj; /* -spacing3 option object. NULL
* means option not specified. */
+#else
+ char *spacing3String; /* -spacing3 option string (malloc-ed). NULL
+ * means option not specified. */
+#endif
int spacing3; /* Extra spacing below last display line for
* text line. INT_MIN means option not specified. */
Tcl_Obj *tabStringPtr; /* -tabs option string. NULL means option not
@@ -403,10 +446,15 @@ typedef struct TkTextTag {
struct TkTextTabArray *tabArrayPtr;
/* Info about tabs for tag (malloc-ed) or
* NULL. Corresponds to tabString. */
+#if TK_MAJOR_VERSION > 8
TkTextTabStyle tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR
* or TK_TEXT_TABSTYLE_NULL (if not specified). */
- Tcl_Obj *underlinePtr; /* -underline option. NULL
+#else
+ int tabStyle; /* One of TABULAR or WORDPROCESSOR or NONE (if
+ * not specified). */
+ char *underlineString; /* -underline option string (malloc-ed). NULL
* means option not specified. */
+#endif
int underline; /* > 0 means draw underline underneath
* text. -1 means not specified. */
XColor *underlineColor; /* Color for the underline. NULL means same
@@ -415,8 +463,10 @@ typedef struct TkTextTag {
* Must be TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_WORD,
* TEXT_WRAPMODE_NONE, or TEXT_WRAPMODE_NULL to
* use wrapmode for whole widget. */
- Tcl_Obj *elideObj; /* -elide option. NULL
+#if TK_MAJOR_VERSION < 9
+ char *elideString; /* -elide option string (malloc-ed). NULL
* means option not specified. */
+#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/tkTextTag.c b/generic/tkTextTag.c
index e21f2ac..7d91201 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, 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, 0, 0},
{TK_OPTION_BITMAP, "-fgstipple", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0},
@@ -34,7 +34,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = {
{TK_OPTION_COLOR, "-foreground", NULL, NULL,
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", NULL, NULL,
- NULL, offsetof(TkTextTag, justifyObj), offsetof(TkTextTag, justify), TK_OPTION_NULL_OK, 0,0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, justify), TK_OPTION_NULL_OK, 0,0},
{TK_OPTION_PIXELS, "-lmargin1", NULL, NULL,
NULL, offsetof(TkTextTag, lMargin1Obj), offsetof(TkTextTag, lMargin1), TK_OPTION_NULL_OK,0,0},
{TK_OPTION_PIXELS, "-lmargin2", NULL, NULL,
@@ -44,13 +44,13 @@ static const Tk_OptionSpec tagOptionSpecs[] = {
{TK_OPTION_PIXELS, "-offset", NULL, NULL,
NULL, offsetof(TkTextTag, offsetObj), offsetof(TkTextTag, offset), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL,
- NULL, offsetof(TkTextTag, overstrikePtr), 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),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", NULL, NULL,
- NULL, offsetof(TkTextTag, reliefObj), offsetof(TkTextTag, relief), TK_OPTION_NULL_OK, 0, 0},
+ NULL, TCL_INDEX_NONE, offsetof(TkTextTag, relief), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-rmargin", NULL, NULL,
NULL, offsetof(TkTextTag, rMarginObj), offsetof(TkTextTag, rMargin), TK_OPTION_NULL_OK, 0,0},
{TK_OPTION_BORDER, "-rmargincolor", NULL, NULL,
@@ -71,7 +71,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = {
NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tabStyle),
TK_OPTION_NULL_OK|TK_OPTION_ENUM_VAR, tkTextTabStyleStrings, 0},
{TK_OPTION_BOOLEAN, "-underline", NULL, NULL,
- NULL, offsetof(TkTextTag, underlinePtr), 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),
@@ -945,13 +945,11 @@ TkTextCreateTag(
tagPtr->border = NULL;
tagPtr->borderWidth = 0;
tagPtr->borderWidthPtr = NULL;
- tagPtr->reliefObj = NULL;
tagPtr->relief = TK_RELIEF_NULL;
tagPtr->bgStipple = None;
tagPtr->fgColor = NULL;
tagPtr->tkfont = NULL;
tagPtr->fgStipple = None;
- tagPtr->justifyObj = NULL;
tagPtr->justify = TK_JUSTIFY_NULL;
tagPtr->lMargin1Obj = NULL;
tagPtr->lMargin1 = INT_MIN;
@@ -960,7 +958,6 @@ TkTextCreateTag(
tagPtr->lMarginColor = NULL;
tagPtr->offsetObj = NULL;
tagPtr->offset = INT_MIN;
- tagPtr->overstrikePtr = NULL;
tagPtr->overstrike = -1;
tagPtr->overstrikeColor = NULL;
tagPtr->rMarginObj = NULL;
@@ -977,10 +974,8 @@ TkTextCreateTag(
tagPtr->tabStringPtr = NULL;
tagPtr->tabArrayPtr = NULL;
tagPtr->tabStyle = TK_TEXT_TABSTYLE_NULL;
- tagPtr->underlinePtr = NULL;
tagPtr->underline = -1;
tagPtr->underlineColor = NULL;
- tagPtr->elideObj = NULL;
tagPtr->elide = -1;
tagPtr->wrapMode = TEXT_WRAPMODE_NULL;
tagPtr->affectsDisplay = 0;
diff --git a/tests/textTag.test b/tests/textTag.test
index f3bc53e..b33787e 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -169,7 +169,7 @@ test textTag-1.20 {tag configuration options} -body {
.t tag cget x -overstrike
} -cleanup {
.t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3]
-} -result {on}
+} -result 1
test textTag-1.21 {configuration options} -body {
.t tag configure x -overstrike stupid
} -cleanup {
@@ -291,7 +291,7 @@ test textTag-1.34 {tag configuration options} -body {
.t tag cget x -underline
} -cleanup {
.t tag configure x -underline [lindex [.t tag configure x -underline] 3]
-} -result {no}
+} -result 0
test textTag-1.35 {configuration options} -body {
.t tag configure x -underline stupid
} -cleanup {
@@ -501,7 +501,7 @@ test textTag-5.4 {TkTextTagCmd - "configure" option} -body {
.t tag configure x -underline
} -cleanup {
.t tag delete x
-} -result {-underline {} {} {} yes}
+} -result {-underline {} {} {} 1}
test textTag-5.4a {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -underlinefg lightgreen
@@ -515,7 +515,7 @@ test textTag-5.5 {TkTextTagCmd - "configure" option} -body {
.t tag cget x -overstrike
} -cleanup {
.t tag delete x
-} -result {on}
+} -result 1
test textTag-5.5a {TkTextTagCmd - "configure" option} -body {
.t tag delete x
.t tag configure x -overstrikefg lightgreen