diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-22 08:18:25 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-22 08:18:25 +0300 |
commit | b2448c68011f310e312de61cbfea86059ef730da (patch) | |
tree | 0f2a41272945a3fe2154eb9fca2435654fe77ce4 /src | |
parent | 6a5bf6357269694294ff79845c46190f3ce2b53d (diff) |
Cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/inputwidget.h | 1 | ||||
-rw-r--r-- | src/ui/text.c | 34 |
2 files changed, 0 insertions, 35 deletions
diff --git a/src/ui/inputwidget.h b/src/ui/inputwidget.h index a4246733..fb6f305a 100644 --- a/src/ui/inputwidget.h +++ b/src/ui/inputwidget.h | |||
@@ -47,7 +47,6 @@ void setMaxLen_InputWidget (iInputWidget *, size_t maxLen); | |||
47 | void setText_InputWidget (iInputWidget *, const iString *text); | 47 | void setText_InputWidget (iInputWidget *, const iString *text); |
48 | void setTextCStr_InputWidget (iInputWidget *, const char *cstr); | 48 | void setTextCStr_InputWidget (iInputWidget *, const char *cstr); |
49 | void setFont_InputWidget (iInputWidget *, int fontId); | 49 | void setFont_InputWidget (iInputWidget *, int fontId); |
50 | //void setCursor_InputWidget (iInputWidget *, size_t pos); | ||
51 | void setContentPadding_InputWidget (iInputWidget *, int left, int right); /* only affects the text entry */ | 50 | void setContentPadding_InputWidget (iInputWidget *, int left, int right); /* only affects the text entry */ |
52 | void setLineLimits_InputWidget (iInputWidget *, int minLines, int maxLines); | 51 | void setLineLimits_InputWidget (iInputWidget *, int minLines, int maxLines); |
53 | void setValidator_InputWidget (iInputWidget *, iInputWidgetValidatorFunc validator, void *context); | 52 | void setValidator_InputWidget (iInputWidget *, iInputWidgetValidatorFunc validator, void *context); |
diff --git a/src/ui/text.c b/src/ui/text.c index bbfd71b8..032cbf2f 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -2153,21 +2153,6 @@ static void initWrap_TextBuf_(iTextBuf *d, int font, int color, int maxWidth, iB | |||
2153 | .mode = (doWrap ? word_WrapTextMode : anyCharacter_WrapTextMode), | 2153 | .mode = (doWrap ? word_WrapTextMode : anyCharacter_WrapTextMode), |
2154 | }; | 2154 | }; |
2155 | d->size = measure_WrapText(&wrapText, font).bounds.size; | 2155 | d->size = measure_WrapText(&wrapText, font).bounds.size; |
2156 | #if 0 | ||
2157 | if (maxWidth == 0) { | ||
2158 | d->size = measure_Text(font, text).bounds.size; | ||
2159 | } | ||
2160 | else { | ||
2161 | d->size = zero_I2(); | ||
2162 | iRangecc content = range_CStr(text); | ||
2163 | while (!isEmpty_Range(&content)) { | ||
2164 | const iInt2 size = (doWrap ? tryAdvance_Text(font, content, maxWidth, &content.start) | ||
2165 | : tryAdvanceNoWrap_Text(font, content, maxWidth, &content.start)); | ||
2166 | d->size.x = iMax(d->size.x, size.x); | ||
2167 | d->size.y += iMax(size.y, lineHeight_Text(font)); | ||
2168 | } | ||
2169 | } | ||
2170 | #endif | ||
2171 | SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); | 2156 | SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); |
2172 | if (d->size.x * d->size.y) { | 2157 | if (d->size.x * d->size.y) { |
2173 | d->texture = SDL_CreateTexture(render, | 2158 | d->texture = SDL_CreateTexture(render, |
@@ -2186,25 +2171,6 @@ static void initWrap_TextBuf_(iTextBuf *d, int font, int color, int maxWidth, iB | |||
2186 | SDL_SetRenderDrawColor(render, 255, 255, 255, 0); | 2171 | SDL_SetRenderDrawColor(render, 255, 255, 255, 0); |
2187 | SDL_RenderClear(render); | 2172 | SDL_RenderClear(render); |
2188 | SDL_SetTextureBlendMode(text_.cache, SDL_BLENDMODE_NONE); /* blended when TextBuf is drawn */ | 2173 | SDL_SetTextureBlendMode(text_.cache, SDL_BLENDMODE_NONE); /* blended when TextBuf is drawn */ |
2189 | #if 0 | ||
2190 | iRangecc range = range_CStr(text); | ||
2191 | if (maxWidth == 0) { | ||
2192 | draw_Text_(font, zero_I2(), fg, range); | ||
2193 | } | ||
2194 | else if (doWrap) { | ||
2195 | drawWrapRange_Text(font, zero_I2(), maxWidth, fg, range); | ||
2196 | } | ||
2197 | else { | ||
2198 | iInt2 pos = zero_I2(); | ||
2199 | while (!isEmpty_Range(&range)) { | ||
2200 | const char *endp; | ||
2201 | tryAdvanceNoWrap_Text(font, range, maxWidth, &endp); | ||
2202 | draw_Text_(font, pos, fg, (iRangecc){ range.start, endp }); | ||
2203 | range.start = endp; | ||
2204 | pos.y += lineHeight_Text(font); | ||
2205 | } | ||
2206 | } | ||
2207 | #endif | ||
2208 | draw_WrapText(&wrapText, font, zero_I2(), color | fillBackground_ColorId); | 2174 | draw_WrapText(&wrapText, font, zero_I2(), color | fillBackground_ColorId); |
2209 | SDL_SetTextureBlendMode(text_.cache, SDL_BLENDMODE_BLEND); | 2175 | SDL_SetTextureBlendMode(text_.cache, SDL_BLENDMODE_BLEND); |
2210 | SDL_SetRenderTarget(render, oldTarget); | 2176 | SDL_SetRenderTarget(render, oldTarget); |