diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 18 | ||||
-rw-r--r-- | src/ui/text.c | 9 | ||||
-rw-r--r-- | src/ui/text.h | 17 |
3 files changed, 25 insertions, 19 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index f7ef6d79..ac283a21 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -2908,7 +2908,7 @@ static size_t linkOrdinalFromKey_DocumentWidget_(const iDocumentWidget *d, int k | |||
2908 | static iChar linkOrdinalChar_DocumentWidget_(const iDocumentWidget *d, size_t ord) { | 2908 | static iChar linkOrdinalChar_DocumentWidget_(const iDocumentWidget *d, size_t ord) { |
2909 | if (d->ordinalMode == numbersAndAlphabet_DocumentLinkOrdinalMode) { | 2909 | if (d->ordinalMode == numbersAndAlphabet_DocumentLinkOrdinalMode) { |
2910 | if (ord < 9) { | 2910 | if (ord < 9) { |
2911 | return 0x278a + ord; | 2911 | return '1' + ord; |
2912 | } | 2912 | } |
2913 | #if defined (iPlatformApple) | 2913 | #if defined (iPlatformApple) |
2914 | if (ord < 9 + 22) { | 2914 | if (ord < 9 + 22) { |
@@ -2917,17 +2917,17 @@ static iChar linkOrdinalChar_DocumentWidget_(const iDocumentWidget *d, size_t or | |||
2917 | if (key >= 'm') key++; | 2917 | if (key >= 'm') key++; |
2918 | if (key >= 'q') key++; | 2918 | if (key >= 'q') key++; |
2919 | if (key >= 'w') key++; | 2919 | if (key >= 'w') key++; |
2920 | return 0x24b6 + key - 'a'; | 2920 | return 'A' + key - 'a'; |
2921 | } | 2921 | } |
2922 | #else | 2922 | #else |
2923 | if (ord < 9 + 26) { | 2923 | if (ord < 9 + 26) { |
2924 | return 0x24b6 + ord - 9; | 2924 | return 'A' + ord - 9; |
2925 | } | 2925 | } |
2926 | #endif | 2926 | #endif |
2927 | } | 2927 | } |
2928 | else { | 2928 | else { |
2929 | if (ord < iElemCount(homeRowKeys_)) { | 2929 | if (ord < iElemCount(homeRowKeys_)) { |
2930 | return 0x24b6 + homeRowKeys_[ord] - 'a'; | 2930 | return 'A' + homeRowKeys_[ord] - 'a'; |
2931 | } | 2931 | } |
2932 | } | 2932 | } |
2933 | return 0; | 2933 | return 0; |
@@ -3818,10 +3818,12 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3818 | const iChar ordChar = | 3818 | const iChar ordChar = |
3819 | linkOrdinalChar_DocumentWidget_(d->widget, ord - d->widget->ordinalBase); | 3819 | linkOrdinalChar_DocumentWidget_(d->widget, ord - d->widget->ordinalBase); |
3820 | if (ordChar) { | 3820 | if (ordChar) { |
3821 | drawString_Text(run->font, | 3821 | const char *circle = "\u25ef"; /* Large Circle */ |
3822 | init_I2(d->viewPos.x - gap_UI / 3, visPos.y), | 3822 | iRect nbArea = { init_I2(d->viewPos.x - gap_UI / 3, visPos.y), |
3823 | tmQuote_ColorId, | 3823 | init_I2(4 * gap_UI, lineHeight_Text(run->font)) }; |
3824 | collect_String(newUnicodeN_String(&ordChar, 1))); | 3824 | drawRange_Text(run->font, topLeft_Rect(nbArea), tmQuote_ColorId, |
3825 | range_CStr(circle)); | ||
3826 | drawCentered_Text(run->font, nbArea, iTrue, tmQuote_ColorId, "%lc", (int) ordChar); | ||
3825 | goto runDrawn; | 3827 | goto runDrawn; |
3826 | } | 3828 | } |
3827 | } | 3829 | } |
diff --git a/src/ui/text.c b/src/ui/text.c index 54b0a9da..980f15bd 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -1341,13 +1341,16 @@ void drawCentered_Text(int fontId, iRect rect, iBool alignVisual, int color, con | |||
1341 | vprintf_Block(&chars, format, args); | 1341 | vprintf_Block(&chars, format, args); |
1342 | va_end(args); | 1342 | va_end(args); |
1343 | } | 1343 | } |
1344 | const iRangecc text = range_Block(&chars); | 1344 | drawCenteredRange_Text(fontId, rect, alignVisual, color, range_Block(&chars)); |
1345 | iRect textBounds = alignVisual ? visualBounds_Text(fontId, text) | 1345 | deinit_Block(&chars); |
1346 | } | ||
1347 | |||
1348 | void drawCenteredRange_Text(int fontId, iRect rect, iBool alignVisual, int color, iRangecc text) { | ||
1349 | iRect textBounds = alignVisual ? visualBounds_Text(fontId, text) | ||
1346 | : (iRect){ zero_I2(), advanceRange_Text(fontId, text) }; | 1350 | : (iRect){ zero_I2(), advanceRange_Text(fontId, text) }; |
1347 | textBounds.pos = sub_I2(mid_Rect(rect), mid_Rect(textBounds)); | 1351 | textBounds.pos = sub_I2(mid_Rect(rect), mid_Rect(textBounds)); |
1348 | textBounds.pos.x = iMax(textBounds.pos.x, left_Rect(rect)); /* keep left edge visible */ | 1352 | textBounds.pos.x = iMax(textBounds.pos.x, left_Rect(rect)); /* keep left edge visible */ |
1349 | draw_Text_(fontId, textBounds.pos, color, text); | 1353 | draw_Text_(fontId, textBounds.pos, color, text); |
1350 | deinit_Block(&chars); | ||
1351 | } | 1354 | } |
1352 | 1355 | ||
1353 | SDL_Texture *glyphCache_Text(void) { | 1356 | SDL_Texture *glyphCache_Text(void) { |
diff --git a/src/ui/text.h b/src/ui/text.h index 3dc38238..0007b264 100644 --- a/src/ui/text.h +++ b/src/ui/text.h | |||
@@ -157,14 +157,15 @@ void setOpacity_Text (float opacity); | |||
157 | 157 | ||
158 | void cache_Text (int fontId, iRangecc text); /* pre-render glyphs */ | 158 | void cache_Text (int fontId, iRangecc text); /* pre-render glyphs */ |
159 | 159 | ||
160 | void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...); | 160 | void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...); |
161 | void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); | 161 | void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); |
162 | void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); | 162 | void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); |
163 | void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); | 163 | void drawCenteredRange_Text (int fontId, iRect rect, iBool alignVisual, int color, iRangecc text); |
164 | void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); | 164 | void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); |
165 | void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen); | 165 | void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); |
166 | void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ | 166 | void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen); |
167 | int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ | 167 | void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ |
168 | int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ | ||
168 | 169 | ||
169 | SDL_Texture * glyphCache_Text (void); | 170 | SDL_Texture * glyphCache_Text (void); |
170 | 171 | ||