diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-01-18 22:25:37 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-01-18 22:25:37 (GMT) |
commit | 13958a18298831f95c1325b10b60f31eb77b0a3b (patch) | |
tree | 12495c12dbe48ca98f4dc5ece17ddb3a8a964a38 | |
parent | d957bf874f381f7e1efb65dd69990381045f0d13 (diff) | |
download | tk-13958a18298831f95c1325b10b60f31eb77b0a3b.zip tk-13958a18298831f95c1325b10b60f31eb77b0a3b.tar.gz tk-13958a18298831f95c1325b10b60f31eb77b0a3b.tar.bz2 |
int -> TkTextTabStyle wherever possible
-rw-r--r-- | generic/tkText.c | 2 | ||||
-rw-r--r-- | generic/tkText.h | 33 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 6 | ||||
-rw-r--r-- | generic/tkTextTag.c | 2 | ||||
-rw-r--r-- | generic/tkTextWind.c | 2 |
5 files changed, 23 insertions, 22 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index 7866e94..7616d4d 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -230,7 +230,7 @@ static const Tk_OptionSpec optionSpecs[] = { TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING_TABLE, "-tabstyle", "tabStyle", "TabStyle", DEF_TEXT_TABSTYLE, TCL_INDEX_NONE, offsetof(TkText, tabStyle), - 0, tkTextTabStyleStrings, TK_TEXT_LINE_GEOMETRY}, + TK_OPTION_ENUM_VAR, tkTextTabStyleStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_TEXT_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(TkText, takeFocus), TK_OPTION_NULL_OK, 0, 0}, diff --git a/generic/tkText.h b/generic/tkText.h index 4850156..2f663d2 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -288,6 +288,20 @@ typedef enum { TEXT_WRAPMODE_WORD } TkWrapMode; +/* + * The following are the supported styles of tabbing, used for the -tabstyle + * option of the text widget. The first element is only used for tag options. + */ + +typedef enum { + TK_TEXT_TABSTYLE_NULL = -1, + TK_TEXT_TABSTYLE_TABULAR, + TK_TEXT_TABSTYLE_WORDPROCESSOR +} TkTextTabStyle; + +MODULE_SCOPE const char *const tkTextTabStyleStrings[]; + + MODULE_SCOPE const char *const tkTextWrapStrings[]; typedef struct TkTextTag { @@ -385,7 +399,7 @@ typedef struct TkTextTag { struct TkTextTabArray *tabArrayPtr; /* Info about tabs for tag (malloc-ed) or * NULL. Corresponds to tabString. */ - int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR + 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 * means option not specified. */ @@ -454,19 +468,6 @@ typedef struct TkTextSearch { typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign; -/* - * The following are the supported styles of tabbing, used for the -tabstyle - * option of the text widget. The first element is only used for tag options. - */ - -typedef enum { - TK_TEXT_TABSTYLE_NULL = -1, - TK_TEXT_TABSTYLE_TABULAR, - TK_TEXT_TABSTYLE_WORDPROCESSOR -} TkTextTabStyle; - -MODULE_SCOPE const char *const tkTextTabStyleStrings[]; - typedef struct TkTextTab { int location; /* Offset in pixels of this tab stop from the * left margin (lmargin2) of the text. */ @@ -641,7 +642,7 @@ typedef struct TkText { Tcl_Interp *interp; /* Interpreter associated with widget. Used to * delete widget command. */ Tcl_Command widgetCmd; /* Token for text's widget command. */ - TkTextState state; /* Either TK_TEXT_STATE_NORMAL or TK_TEXT_STATE_DISABLED. A + TkTextState state; /* Either TK_TEXT_STATE_DISABLED or TK_TEXT_STATE_NORMAL. A * text widget is read-only when disabled. */ /* @@ -681,7 +682,7 @@ typedef struct TkText { /* Information about tab stops (malloc'ed). * NULL means perform default tabbing * behavior. */ - int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ + TkTextTabStyle tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ /* * Additional information used for displaying: diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 23a6c8a..a684e8b 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -150,7 +150,7 @@ typedef struct StyleValues { int spacing3; /* Spacing below last dline in text line. */ TkTextTabArray *tabArrayPtr;/* Locations and types of tab stops (may be * NULL). */ - int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ + TkTextTabStyle tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ int underline; /* Non-zero means draw underline underneath * text. */ XColor *underlineColor; /* Foreground color for underline underneath @@ -1171,7 +1171,7 @@ LayoutDLine( * chunk. */ TkTextTabArray *tabArrayPtr;/* Tab stops for line; taken from style for * the first character on line. */ - int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ + TkTextTabStyle tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ int tabSize; /* Number of pixels consumed by current tab * stop. */ TkTextDispChunk *lastCharChunkPtr; @@ -8489,7 +8489,7 @@ static int SizeOfTab( TkText *textPtr, /* Information about the text widget as a * whole. */ - int tabStyle, /* One of TK_TEXT_TABSTYLE_TABULAR + TkTextTabStyle tabStyle, /* One of TK_TEXT_TABSTYLE_TABULAR * or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ TkTextTabArray *tabArrayPtr,/* Information about the tab stops that apply * to this line. NULL means use default diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 344fd70..e21f2ac 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -69,7 +69,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = { NULL, offsetof(TkTextTag, tabStringPtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, tabStyle), - TK_OPTION_NULL_OK, tkTextTabStyleStrings, 0}, + TK_OPTION_NULL_OK|TK_OPTION_ENUM_VAR, tkTextTabStyleStrings, 0}, {TK_OPTION_BOOLEAN, "-underline", NULL, NULL, NULL, offsetof(TkTextTag, underlinePtr), offsetof(TkTextTag, underline), TK_OPTION_NULL_OK, 0, 0}, diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 391f836..d283c27 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -100,7 +100,7 @@ typedef enum { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, "center", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, align), - 0, alignStrings, 0}, + TK_OPTION_ENUM_VAR, alignStrings, 0}, {TK_OPTION_STRING, "-create", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, |