summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c18
-rw-r--r--src/ui/text.c9
-rw-r--r--src/ui/text.h17
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
2908static iChar linkOrdinalChar_DocumentWidget_(const iDocumentWidget *d, size_t ord) { 2908static 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
1348void 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
1353SDL_Texture *glyphCache_Text(void) { 1356SDL_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
158void cache_Text (int fontId, iRangecc text); /* pre-render glyphs */ 158void cache_Text (int fontId, iRangecc text); /* pre-render glyphs */
159 159
160void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...); 160void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...);
161void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); 161void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...);
162void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); 162void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...);
163void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); 163void drawCenteredRange_Text (int fontId, iRect rect, iBool alignVisual, int color, iRangecc text);
164void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); 164void drawString_Text (int fontId, iInt2 pos, int color, const iString *text);
165void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen); 165void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text);
166void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ 166void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen);
167int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ 167void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */
168int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */
168 169
169SDL_Texture * glyphCache_Text (void); 170SDL_Texture * glyphCache_Text (void);
170 171