diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-01-19 12:28:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-01-19 12:28:15 (GMT) |
commit | f17310ab6d637ba1c6aab9e26c2790e5a7c91775 (patch) | |
tree | b192f371417202ca79f88ff35c884b34b1cc20af /generic/tkTextWind.c | |
parent | 7d012900cd3eee5f14e3ebd061726ffa3510550f (diff) | |
download | tk-f17310ab6d637ba1c6aab9e26c2790e5a7c91775.zip tk-f17310ab6d637ba1c6aab9e26c2790e5a7c91775.tar.gz tk-f17310ab6d637ba1c6aab9e26c2790e5a7c91775.tar.bz2 |
Improve "-align"
Diffstat (limited to 'generic/tkTextWind.c')
-rw-r--r-- | generic/tkTextWind.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index d283c27..f8ec9f5 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -89,10 +89,6 @@ static const char *const alignStrings[] = { "baseline", "bottom", "center", "top", NULL }; -typedef enum { - ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_TOP -} alignMode; - /* * Information used for parsing window configuration options: */ @@ -295,7 +291,7 @@ TkTextWindowCmd( ewPtr->body.ew.linePtr = NULL; ewPtr->body.ew.tkwin = NULL; ewPtr->body.ew.create = NULL; - ewPtr->body.ew.align = ALIGN_CENTER; + ewPtr->body.ew.align = TK_ALIGN_CENTER; ewPtr->body.ew.padX = ewPtr->body.ew.padY = 0; ewPtr->body.ew.stretch = 0; ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs); @@ -1009,7 +1005,7 @@ EmbWinLayoutProc( chunkPtr->measureProc = NULL; chunkPtr->bboxProc = EmbWinBboxProc; chunkPtr->numBytes = 1; - if (ewPtr->body.ew.align == ALIGN_BASELINE) { + if (ewPtr->body.ew.align == TK_ALIGN_BASELINE) { chunkPtr->minAscent = height - ewPtr->body.ew.padY; chunkPtr->minDescent = ewPtr->body.ew.padY; chunkPtr->minHeight = 0; @@ -1257,23 +1253,23 @@ EmbWinBboxProc( } *xPtr = chunkPtr->x + ewPtr->body.ew.padX; if (ewPtr->body.ew.stretch) { - if (ewPtr->body.ew.align == ALIGN_BASELINE) { + if (ewPtr->body.ew.align == TK_ALIGN_BASELINE) { *heightPtr = baseline - ewPtr->body.ew.padY; } else { *heightPtr = lineHeight - 2*ewPtr->body.ew.padY; } } switch (ewPtr->body.ew.align) { - case ALIGN_BOTTOM: + case TK_ALIGN_BOTTOM: *yPtr = y + (lineHeight - *heightPtr - ewPtr->body.ew.padY); break; - case ALIGN_CENTER: + case TK_ALIGN_CENTER: *yPtr = y + (lineHeight - *heightPtr)/2; break; - case ALIGN_TOP: + case TK_ALIGN_TOP: *yPtr = y + ewPtr->body.ew.padY; break; - case ALIGN_BASELINE: + case TK_ALIGN_BASELINE: *yPtr = y + (baseline - *heightPtr); break; } |