feat(legacy): Use fixed font in SignMessage and VerifyMessage.

pull/1911/head
Andrew Kozlik 3 years ago committed by Andrew Kozlik
parent bec0634bae
commit d8de95767d

@ -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, static bool fsm_layoutPaginated(const char *description, const uint8_t *msg,
uint32_t len, bool is_ascii) { uint32_t len, bool is_ascii) {
const char **str = NULL; const char **str = NULL;
const uint32_t row_len = is_ascii ? 13 : 8; const uint32_t row_len = is_ascii ? 18 : 8;
do { do {
const uint32_t show_len = MIN(len, row_len * 4); const uint32_t show_len = MIN(len, row_len * 4);
if (is_ascii) { if (is_ascii) {
@ -320,8 +320,8 @@ static bool fsm_layoutPaginated(const char *description, const uint8_t *msg,
len -= show_len; len -= show_len;
const char *label = len > 0 ? _("Next") : _("Confirm"); const char *label = len > 0 ? _("Next") : _("Confirm");
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), label, description, layoutDialogSwipeEx(&bmp_icon_question, _("Cancel"), label, description,
str[0], str[1], str[2], str[3], NULL, NULL); str[0], str[1], str[2], str[3], NULL, NULL, FONT_FIXED);
if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) { if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) {
return false; return false;

@ -230,10 +230,19 @@ void layoutDialogSwipe(const BITMAP *icon, const char *btnNo,
const char *btnYes, const char *desc, const char *line1, const char *btnYes, const char *desc, const char *line1,
const char *line2, const char *line3, const char *line4, const char *line2, const char *line3, const char *line4,
const char *line5, const char *line6) { 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; layoutLast = layoutDialogSwipe;
layoutSwipe(); layoutSwipe();
layoutDialog(icon, btnNo, btnYes, desc, line1, line2, line3, line4, line5, layoutDialogEx(icon, btnNo, btnYes, desc, line1, line2, line3, line4, line5,
line6); line6, font);
} }
void layoutProgressSwipe(const char *desc, int permil) { void layoutProgressSwipe(const char *desc, int permil) {

@ -43,6 +43,11 @@ void layoutDialogSwipe(const BITMAP *icon, const char *btnNo,
const char *btnYes, const char *desc, const char *line1, const char *btnYes, const char *desc, const char *line1,
const char *line2, const char *line3, const char *line4, const char *line2, const char *line3, const char *line4,
const char *line5, const char *line6); 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 layoutProgressSwipe(const char *desc, int permil);
void layoutScreensaver(void); void layoutScreensaver(void);

@ -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 *desc, const char *line1, const char *line2,
const char *line3, const char *line4, const char *line5, const char *line3, const char *line4, const char *line5,
const char *line6) { 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; int left = 0;
oledClear(); oledClear();
if (icon) { if (icon) {
oledDrawBitmap(0, 0, icon); oledDrawBitmap(0, 0, icon);
left = icon->width + 4; left = icon->width + 4;
} }
if (line1) oledDrawString(left, 0 * 9, line1, FONT_STANDARD); if (line1) oledDrawString(left, 0 * 9, line1, font);
if (line2) oledDrawString(left, 1 * 9, line2, FONT_STANDARD); if (line2) oledDrawString(left, 1 * 9, line2, font);
if (line3) oledDrawString(left, 2 * 9, line3, FONT_STANDARD); if (line3) oledDrawString(left, 2 * 9, line3, font);
if (line4) oledDrawString(left, 3 * 9, line4, FONT_STANDARD); if (line4) oledDrawString(left, 3 * 9, line4, font);
if (desc) { if (desc) {
oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 2 * 9 - 1, desc, oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 2 * 9 - 1, desc,
FONT_STANDARD); FONT_STANDARD);
@ -68,8 +76,8 @@ void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes,
oledHLine(OLED_HEIGHT - 21); oledHLine(OLED_HEIGHT - 21);
} }
} else { } else {
if (line5) oledDrawString(left, 4 * 9, line5, FONT_STANDARD); if (line5) oledDrawString(left, 4 * 9, line5, font);
if (line6) oledDrawString(left, 5 * 9, line6, FONT_STANDARD); if (line6) oledDrawString(left, 5 * 9, line6, font);
if (btnYes || btnNo) { if (btnYes || btnNo) {
oledHLine(OLED_HEIGHT - 13); oledHLine(OLED_HEIGHT - 13);
} }

@ -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 *desc, const char *line1, const char *line2,
const char *line3, const char *line4, const char *line5, const char *line3, const char *line4, const char *line5,
const char *line6); 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 layoutProgressUpdate(bool refresh);
void layoutProgress(const char *desc, int permil); void layoutProgress(const char *desc, int permil);

Loading…
Cancel
Save