mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
legacy/layout: use bmp_btn_confirm, bmp_btn_cancel
This commit is contained in:
parent
81085ed388
commit
ee98d0b398
@ -339,8 +339,8 @@ static void render_address_dialog(const CoinInfo *coin, const char *address,
|
||||
oledHLine(OLED_HEIGHT - 13);
|
||||
}
|
||||
}
|
||||
layoutButtonNo(_("Cancel"));
|
||||
layoutButtonYes(_("Confirm"));
|
||||
layoutButtonNo(_("Cancel"), &bmp_btn_cancel);
|
||||
layoutButtonYes(_("Confirm"), &bmp_btn_confirm);
|
||||
oledRefresh();
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ void layoutResetWord(const char *word, int pass, int word_pos, bool last) {
|
||||
// 30 is the maximum pixels used for a pixel row in the BIP39 word "abstract"
|
||||
oledSCA(4 * 9 - 3 - 2, 4 * 9 - 3 + 15 + 2, 30);
|
||||
oledInvert(0, 4 * 9 - 3 - 2, OLED_WIDTH - 1, 4 * 9 - 3 + 15 + 2);
|
||||
layoutButtonYes(btnYes);
|
||||
layoutButtonYes(btnYes, &bmp_btn_confirm);
|
||||
oledRefresh();
|
||||
}
|
||||
|
||||
@ -634,10 +634,10 @@ void layoutAddress(const char *address, const char *desc, bool qrcode,
|
||||
}
|
||||
|
||||
if (!qrcode) {
|
||||
layoutButtonNo(_("QR Code"));
|
||||
layoutButtonNo(_("QR Code"), NULL);
|
||||
}
|
||||
|
||||
layoutButtonYes(_("Continue"));
|
||||
layoutButtonYes(_("Continue"), &bmp_btn_confirm);
|
||||
oledRefresh();
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,8 @@ void reset_init(bool display_random, uint32_t _strength,
|
||||
oledDrawStringCenter(OLED_WIDTH / 2, 2 + 3 * 9, ent_str[2], FONT_FIXED);
|
||||
oledDrawStringCenter(OLED_WIDTH / 2, 2 + 4 * 9, ent_str[3], FONT_FIXED);
|
||||
oledHLine(OLED_HEIGHT - 13);
|
||||
layoutButtonNo(_("Cancel"));
|
||||
layoutButtonYes(_("Continue"));
|
||||
layoutButtonNo(_("Cancel"), &bmp_btn_cancel);
|
||||
layoutButtonYes(_("Continue"), &bmp_btn_confirm);
|
||||
// 40 is the maximum pixels used for a row
|
||||
oledSCA(2 + 1 * 9, 2 + 1 * 9 + 6, 40);
|
||||
oledSCA(2 + 2 * 9, 2 + 2 * 9 + 6, 40);
|
||||
|
@ -1792,13 +1792,7 @@ void stellar_layoutSigningDialog(const char *line1, const char *line2,
|
||||
offset_y += line_height;
|
||||
|
||||
// Cancel button
|
||||
oledDrawString(1, OLED_HEIGHT - 8, "\x15", FONT_STANDARD);
|
||||
oledDrawString(fontCharWidth(FONT_STANDARD, '\x15') + 3, OLED_HEIGHT - 8,
|
||||
"Cancel", FONT_STANDARD);
|
||||
oledInvert(0, OLED_HEIGHT - 9,
|
||||
fontCharWidth(FONT_STANDARD, '\x15') +
|
||||
oledStringWidth("Cancel", FONT_STANDARD) + 2,
|
||||
OLED_HEIGHT - 1);
|
||||
layoutButtonNo("Cancel", &bmp_btn_cancel);
|
||||
|
||||
// Warnings (drawn centered between the buttons
|
||||
if (warning) {
|
||||
@ -1814,14 +1808,7 @@ void stellar_layoutSigningDialog(const char *line1, const char *line2,
|
||||
strlcpy(str_next_label, _("Next"), sizeof(str_next_label));
|
||||
}
|
||||
|
||||
oledDrawString(OLED_WIDTH - fontCharWidth(FONT_STANDARD, '\x06') - 1,
|
||||
OLED_HEIGHT - 8, "\x06", FONT_STANDARD);
|
||||
oledDrawString(OLED_WIDTH - oledStringWidth(str_next_label, FONT_STANDARD) -
|
||||
fontCharWidth(FONT_STANDARD, '\x06') - 3,
|
||||
OLED_HEIGHT - 8, str_next_label, FONT_STANDARD);
|
||||
oledInvert(OLED_WIDTH - oledStringWidth(str_next_label, FONT_STANDARD) -
|
||||
fontCharWidth(FONT_STANDARD, '\x06') - 4,
|
||||
OLED_HEIGHT - 9, OLED_WIDTH - 1, OLED_HEIGHT - 1);
|
||||
layoutButtonYes(str_next_label, &bmp_btn_confirm);
|
||||
|
||||
oledRefresh();
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
// clang-format off
|
||||
#include "bitmaps.h"
|
||||
|
||||
const uint8_t bmp_btn_cancel_data[] = { 0x44, 0xee, 0x7c, 0x38, 0x7c, 0xee, 0x44, 0x00, };
|
||||
const uint8_t bmp_btn_confirm_data[] = { 0x02, 0x04, 0x08, 0xd8, 0xf0, 0x60, 0x20, 0x00, };
|
||||
const uint8_t bmp_digit0_data[] = { 0xff, 0xff, 0xf8, 0x1f, 0xf0, 0x0f, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xf0, 0x0f, 0xf8, 0x1f, 0xff, 0xff, };
|
||||
const uint8_t bmp_digit1_data[] = { 0xff, 0xff, 0xfc, 0x3f, 0xf8, 0x3f, 0xf0, 0x3f, 0xf0, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xff, 0xff, };
|
||||
const uint8_t bmp_digit2_data[] = { 0xff, 0xff, 0xe0, 0x1f, 0xe0, 0x0f, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xf8, 0x0f, 0xf0, 0x1f, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe0, 0x07, 0xe0, 0x07, 0xff, 0xff, };
|
||||
@ -26,6 +28,8 @@ const uint8_t bmp_logo64_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x
|
||||
const uint8_t bmp_logo64_empty_data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x07, 0xe0, 0x10, 0x00, 0x00, 0x10, 0x08, 0x10, 0x08, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x20, 0x20, 0x04, 0x04, 0x00, 0x00, 0x20, 0x40, 0x02, 0x04, 0x00, 0x00, 0x40, 0x80, 0x01, 0x02, 0x00, 0x00, 0x40, 0x80, 0x01, 0x02, 0x00, 0x00, 0x40, 0x80, 0x01, 0x02, 0x00, 0x00, 0x40, 0x80, 0x01, 0x02, 0x00, 0x00, 0x40, 0x80, 0x01, 0x02, 0x00, 0x00, 0x40, 0x80, 0x01, 0x02, 0x00, 0x00, 0x40, 0x80, 0x01, 0x02, 0x00, 0x00, 0x40, 0x80, 0x01, 0x02, 0x00, 0x1f, 0xc0, 0xff, 0xff, 0x03, 0xf8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3f, 0xff, 0xff, 0xfc, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x04, 0x08, 0x10, 0x18, 0x00, 0x00, 0x18, 0x08, 0x10, 0x06, 0x00, 0x00, 0x60, 0x08, 0x10, 0x01, 0x80, 0x01, 0x80, 0x08, 0x10, 0x00, 0x60, 0x06, 0x00, 0x08, 0x18, 0x00, 0x18, 0x18, 0x00, 0x18, 0x06, 0x00, 0x06, 0x60, 0x00, 0x60, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x00, 0x60, 0x00, 0x00, 0x06, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x00, 0x00, 0x01, 0x80, 0x01, 0x80, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
|
||||
const uint8_t bmp_webauthn_data[] = { 0x00, 0x00, 0x1f, 0x80, 0x00, 0x00, 0x7f, 0xe0, 0x00, 0x01, 0xff, 0xf8, 0x00, 0x03, 0xfe, 0x1c, 0x00, 0x03, 0xfc, 0x0c, 0x00, 0x07, 0xf8, 0x06, 0x00, 0x07, 0xf8, 0x06, 0x00, 0x0f, 0xf8, 0x06, 0x00, 0x0f, 0xf8, 0x07, 0x00, 0x0f, 0xfc, 0x0f, 0x00, 0x0f, 0xfe, 0x1f, 0x00, 0x0f, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0x07, 0xff, 0xfe, 0x00, 0x0f, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xfc, 0x00, 0x3f, 0xff, 0xfc, 0x00, 0x7f, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xdf, 0x80, 0x03, 0xff, 0x80, 0x00, 0x07, 0xff, 0x00, 0x00, 0x0f, 0xfe, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, };
|
||||
|
||||
const BITMAP bmp_btn_cancel = {8, 8, bmp_btn_cancel_data};
|
||||
const BITMAP bmp_btn_confirm = {8, 8, bmp_btn_confirm_data};
|
||||
const BITMAP bmp_digit0 = {16, 16, bmp_digit0_data};
|
||||
const BITMAP bmp_digit1 = {16, 16, bmp_digit1_data};
|
||||
const BITMAP bmp_digit2 = {16, 16, bmp_digit2_data};
|
||||
|
@ -8,6 +8,8 @@ typedef struct {
|
||||
const uint8_t *data;
|
||||
} BITMAP;
|
||||
|
||||
extern const BITMAP bmp_btn_cancel;
|
||||
extern const BITMAP bmp_btn_confirm;
|
||||
extern const BITMAP bmp_digit0;
|
||||
extern const BITMAP bmp_digit1;
|
||||
extern const BITMAP bmp_digit2;
|
||||
|
BIN
legacy/gen/bitmaps/btn_cancel.png
Normal file
BIN
legacy/gen/bitmaps/btn_cancel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 877 B |
BIN
legacy/gen/bitmaps/btn_confirm.png
Normal file
BIN
legacy/gen/bitmaps/btn_confirm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 844 B |
@ -22,24 +22,29 @@
|
||||
#include "layout.h"
|
||||
#include "oled.h"
|
||||
|
||||
void layoutButtonNo(const char *btnNo) {
|
||||
oledDrawString(1, OLED_HEIGHT - 8, "\x15", FONT_STANDARD);
|
||||
oledDrawString(fontCharWidth(FONT_STANDARD, '\x15') + 3, OLED_HEIGHT - 8,
|
||||
btnNo, FONT_STANDARD);
|
||||
void layoutButtonNo(const char *btnNo, const BITMAP *icon) {
|
||||
int icon_width = 0;
|
||||
if (icon) {
|
||||
oledDrawBitmap(1, OLED_HEIGHT - 8, icon);
|
||||
icon_width = icon->width;
|
||||
}
|
||||
oledDrawString(8 + 3, OLED_HEIGHT - icon_width, btnNo, FONT_STANDARD);
|
||||
oledInvert(0, OLED_HEIGHT - 9,
|
||||
fontCharWidth(FONT_STANDARD, '\x15') +
|
||||
oledStringWidth(btnNo, FONT_STANDARD) + 2,
|
||||
icon_width + oledStringWidth(btnNo, FONT_STANDARD) + 2,
|
||||
OLED_HEIGHT - 1);
|
||||
}
|
||||
|
||||
void layoutButtonYes(const char *btnYes) {
|
||||
oledDrawString(OLED_WIDTH - fontCharWidth(FONT_STANDARD, '\x06') - 1,
|
||||
OLED_HEIGHT - 8, "\x06", FONT_STANDARD);
|
||||
oledDrawStringRight(OLED_WIDTH - fontCharWidth(FONT_STANDARD, '\x06') - 3,
|
||||
OLED_HEIGHT - 8, btnYes, FONT_STANDARD);
|
||||
oledInvert(OLED_WIDTH - oledStringWidth(btnYes, FONT_STANDARD) -
|
||||
fontCharWidth(FONT_STANDARD, '\x06') - 4,
|
||||
OLED_HEIGHT - 9, OLED_WIDTH - 1, OLED_HEIGHT - 1);
|
||||
void layoutButtonYes(const char *btnYes, const BITMAP *icon) {
|
||||
int icon_width = 0;
|
||||
if (icon) {
|
||||
oledDrawBitmap(OLED_WIDTH - 8 - 1, OLED_HEIGHT - 8, icon);
|
||||
icon_width = icon->width;
|
||||
}
|
||||
oledDrawStringRight(OLED_WIDTH - icon_width - 3, OLED_HEIGHT - 8, btnYes,
|
||||
FONT_STANDARD);
|
||||
oledInvert(
|
||||
OLED_WIDTH - oledStringWidth(btnYes, FONT_STANDARD) - icon_width - 4,
|
||||
OLED_HEIGHT - 9, OLED_WIDTH - 1, OLED_HEIGHT - 1);
|
||||
}
|
||||
|
||||
void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes,
|
||||
@ -70,10 +75,10 @@ void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes,
|
||||
}
|
||||
}
|
||||
if (btnNo) {
|
||||
layoutButtonNo(btnNo);
|
||||
layoutButtonNo(btnNo, &bmp_btn_cancel);
|
||||
}
|
||||
if (btnYes) {
|
||||
layoutButtonYes(btnYes);
|
||||
layoutButtonYes(btnYes, &bmp_btn_confirm);
|
||||
}
|
||||
oledRefresh();
|
||||
}
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include <stdlib.h>
|
||||
#include "bitmaps.h"
|
||||
|
||||
void layoutButtonNo(const char *btnNo);
|
||||
void layoutButtonYes(const char *btnYes);
|
||||
void layoutButtonNo(const char *btnNo, const BITMAP *icon);
|
||||
void layoutButtonYes(const char *btnYes, const BITMAP *icon);
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user