From d8de95767d9f941ce1225f5cc5271dccb8db28a1 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Tue, 9 Nov 2021 10:06:56 +0100 Subject: [PATCH] feat(legacy): Use fixed font in SignMessage and VerifyMessage. --- legacy/firmware/fsm.c | 6 +++--- legacy/firmware/layout2.c | 13 +++++++++++-- legacy/firmware/layout2.h | 5 +++++ legacy/layout.c | 20 ++++++++++++++------ legacy/layout.h | 4 ++++ 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/legacy/firmware/fsm.c b/legacy/firmware/fsm.c index 2d8448a95..b315cb213 100644 --- a/legacy/firmware/fsm.c +++ b/legacy/firmware/fsm.c @@ -307,7 +307,7 @@ static bool fsm_layoutAddress(const char *address, const char *desc, static bool fsm_layoutPaginated(const char *description, const uint8_t *msg, uint32_t len, bool is_ascii) { const char **str = NULL; - const uint32_t row_len = is_ascii ? 13 : 8; + const uint32_t row_len = is_ascii ? 18 : 8; do { const uint32_t show_len = MIN(len, row_len * 4); if (is_ascii) { @@ -320,8 +320,8 @@ static bool fsm_layoutPaginated(const char *description, const uint8_t *msg, len -= show_len; const char *label = len > 0 ? _("Next") : _("Confirm"); - layoutDialogSwipe(&bmp_icon_question, _("Cancel"), label, description, - str[0], str[1], str[2], str[3], NULL, NULL); + layoutDialogSwipeEx(&bmp_icon_question, _("Cancel"), label, description, + str[0], str[1], str[2], str[3], NULL, NULL, FONT_FIXED); if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) { return false; diff --git a/legacy/firmware/layout2.c b/legacy/firmware/layout2.c index 48b532c15..8140d61f4 100644 --- a/legacy/firmware/layout2.c +++ b/legacy/firmware/layout2.c @@ -230,10 +230,19 @@ void layoutDialogSwipe(const BITMAP *icon, const char *btnNo, const char *btnYes, const char *desc, const char *line1, const char *line2, const char *line3, const char *line4, const char *line5, const char *line6) { + layoutDialogSwipeEx(icon, btnNo, btnYes, desc, line1, line2, line3, line4, + line5, line6, FONT_STANDARD); +} + +void layoutDialogSwipeEx(const BITMAP *icon, const char *btnNo, + const char *btnYes, const char *desc, + const char *line1, const char *line2, + const char *line3, const char *line4, + const char *line5, const char *line6, uint8_t font) { layoutLast = layoutDialogSwipe; layoutSwipe(); - layoutDialog(icon, btnNo, btnYes, desc, line1, line2, line3, line4, line5, - line6); + layoutDialogEx(icon, btnNo, btnYes, desc, line1, line2, line3, line4, line5, + line6, font); } void layoutProgressSwipe(const char *desc, int permil) { diff --git a/legacy/firmware/layout2.h b/legacy/firmware/layout2.h index 62d2c3046..6c2869258 100644 --- a/legacy/firmware/layout2.h +++ b/legacy/firmware/layout2.h @@ -43,6 +43,11 @@ void layoutDialogSwipe(const BITMAP *icon, const char *btnNo, const char *btnYes, const char *desc, const char *line1, const char *line2, const char *line3, const char *line4, const char *line5, const char *line6); +void layoutDialogSwipeEx(const BITMAP *icon, const char *btnNo, + const char *btnYes, const char *desc, + const char *line1, const char *line2, + const char *line3, const char *line4, + const char *line5, const char *line6, uint8_t font); void layoutProgressSwipe(const char *desc, int permil); void layoutScreensaver(void); diff --git a/legacy/layout.c b/legacy/layout.c index 51c8bfefb..02fcb91a8 100644 --- a/legacy/layout.c +++ b/legacy/layout.c @@ -51,16 +51,24 @@ void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes, const char *desc, const char *line1, const char *line2, const char *line3, const char *line4, const char *line5, const char *line6) { + layoutDialogEx(icon, btnNo, btnYes, desc, line1, line2, line3, line4, line5, + line6, FONT_STANDARD); +} + +void layoutDialogEx(const BITMAP *icon, const char *btnNo, const char *btnYes, + const char *desc, const char *line1, const char *line2, + const char *line3, const char *line4, const char *line5, + const char *line6, uint8_t font) { int left = 0; oledClear(); if (icon) { oledDrawBitmap(0, 0, icon); left = icon->width + 4; } - if (line1) oledDrawString(left, 0 * 9, line1, FONT_STANDARD); - if (line2) oledDrawString(left, 1 * 9, line2, FONT_STANDARD); - if (line3) oledDrawString(left, 2 * 9, line3, FONT_STANDARD); - if (line4) oledDrawString(left, 3 * 9, line4, FONT_STANDARD); + if (line1) oledDrawString(left, 0 * 9, line1, font); + if (line2) oledDrawString(left, 1 * 9, line2, font); + if (line3) oledDrawString(left, 2 * 9, line3, font); + if (line4) oledDrawString(left, 3 * 9, line4, font); if (desc) { oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 2 * 9 - 1, desc, FONT_STANDARD); @@ -68,8 +76,8 @@ void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes, oledHLine(OLED_HEIGHT - 21); } } else { - if (line5) oledDrawString(left, 4 * 9, line5, FONT_STANDARD); - if (line6) oledDrawString(left, 5 * 9, line6, FONT_STANDARD); + if (line5) oledDrawString(left, 4 * 9, line5, font); + if (line6) oledDrawString(left, 5 * 9, line6, font); if (btnYes || btnNo) { oledHLine(OLED_HEIGHT - 13); } diff --git a/legacy/layout.h b/legacy/layout.h index 4b3f92acf..bb6baa2fc 100644 --- a/legacy/layout.h +++ b/legacy/layout.h @@ -30,6 +30,10 @@ void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes, const char *desc, const char *line1, const char *line2, const char *line3, const char *line4, const char *line5, const char *line6); +void layoutDialogEx(const BITMAP *icon, const char *btnNo, const char *btnYes, + const char *desc, const char *line1, const char *line2, + const char *line3, const char *line4, const char *line5, + const char *line6, uint8_t font); void layoutProgressUpdate(bool refresh); void layoutProgress(const char *desc, int permil);