1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

legacy/layout: use bmp_btn_confirm, bmp_btn_cancel

This commit is contained in:
Pavol Rusnak 2019-11-09 16:12:36 +00:00
parent 81085ed388
commit ee98d0b398
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
9 changed files with 38 additions and 40 deletions

View File

@ -339,8 +339,8 @@ static void render_address_dialog(const CoinInfo *coin, const char *address,
oledHLine(OLED_HEIGHT - 13); oledHLine(OLED_HEIGHT - 13);
} }
} }
layoutButtonNo(_("Cancel")); layoutButtonNo(_("Cancel"), &bmp_btn_cancel);
layoutButtonYes(_("Confirm")); layoutButtonYes(_("Confirm"), &bmp_btn_confirm);
oledRefresh(); 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" // 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); 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); oledInvert(0, 4 * 9 - 3 - 2, OLED_WIDTH - 1, 4 * 9 - 3 + 15 + 2);
layoutButtonYes(btnYes); layoutButtonYes(btnYes, &bmp_btn_confirm);
oledRefresh(); oledRefresh();
} }
@ -634,10 +634,10 @@ void layoutAddress(const char *address, const char *desc, bool qrcode,
} }
if (!qrcode) { if (!qrcode) {
layoutButtonNo(_("QR Code")); layoutButtonNo(_("QR Code"), NULL);
} }
layoutButtonYes(_("Continue")); layoutButtonYes(_("Continue"), &bmp_btn_confirm);
oledRefresh(); oledRefresh();
} }

View File

@ -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 + 3 * 9, ent_str[2], FONT_FIXED);
oledDrawStringCenter(OLED_WIDTH / 2, 2 + 4 * 9, ent_str[3], FONT_FIXED); oledDrawStringCenter(OLED_WIDTH / 2, 2 + 4 * 9, ent_str[3], FONT_FIXED);
oledHLine(OLED_HEIGHT - 13); oledHLine(OLED_HEIGHT - 13);
layoutButtonNo(_("Cancel")); layoutButtonNo(_("Cancel"), &bmp_btn_cancel);
layoutButtonYes(_("Continue")); layoutButtonYes(_("Continue"), &bmp_btn_confirm);
// 40 is the maximum pixels used for a row // 40 is the maximum pixels used for a row
oledSCA(2 + 1 * 9, 2 + 1 * 9 + 6, 40); oledSCA(2 + 1 * 9, 2 + 1 * 9 + 6, 40);
oledSCA(2 + 2 * 9, 2 + 2 * 9 + 6, 40); oledSCA(2 + 2 * 9, 2 + 2 * 9 + 6, 40);

View File

@ -1792,13 +1792,7 @@ void stellar_layoutSigningDialog(const char *line1, const char *line2,
offset_y += line_height; offset_y += line_height;
// Cancel button // Cancel button
oledDrawString(1, OLED_HEIGHT - 8, "\x15", FONT_STANDARD); layoutButtonNo("Cancel", &bmp_btn_cancel);
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);
// Warnings (drawn centered between the buttons // Warnings (drawn centered between the buttons
if (warning) { if (warning) {
@ -1814,14 +1808,7 @@ void stellar_layoutSigningDialog(const char *line1, const char *line2,
strlcpy(str_next_label, _("Next"), sizeof(str_next_label)); strlcpy(str_next_label, _("Next"), sizeof(str_next_label));
} }
oledDrawString(OLED_WIDTH - fontCharWidth(FONT_STANDARD, '\x06') - 1, layoutButtonYes(str_next_label, &bmp_btn_confirm);
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);
oledRefresh(); oledRefresh();
} }

View File

@ -1,6 +1,8 @@
// clang-format off // clang-format off
#include "bitmaps.h" #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_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_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, }; 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_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 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_digit0 = {16, 16, bmp_digit0_data};
const BITMAP bmp_digit1 = {16, 16, bmp_digit1_data}; const BITMAP bmp_digit1 = {16, 16, bmp_digit1_data};
const BITMAP bmp_digit2 = {16, 16, bmp_digit2_data}; const BITMAP bmp_digit2 = {16, 16, bmp_digit2_data};

View File

@ -8,6 +8,8 @@ typedef struct {
const uint8_t *data; const uint8_t *data;
} BITMAP; } BITMAP;
extern const BITMAP bmp_btn_cancel;
extern const BITMAP bmp_btn_confirm;
extern const BITMAP bmp_digit0; extern const BITMAP bmp_digit0;
extern const BITMAP bmp_digit1; extern const BITMAP bmp_digit1;
extern const BITMAP bmp_digit2; extern const BITMAP bmp_digit2;

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

View File

@ -22,24 +22,29 @@
#include "layout.h" #include "layout.h"
#include "oled.h" #include "oled.h"
void layoutButtonNo(const char *btnNo) { void layoutButtonNo(const char *btnNo, const BITMAP *icon) {
oledDrawString(1, OLED_HEIGHT - 8, "\x15", FONT_STANDARD); int icon_width = 0;
oledDrawString(fontCharWidth(FONT_STANDARD, '\x15') + 3, OLED_HEIGHT - 8, if (icon) {
btnNo, FONT_STANDARD); 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, oledInvert(0, OLED_HEIGHT - 9,
fontCharWidth(FONT_STANDARD, '\x15') + icon_width + oledStringWidth(btnNo, FONT_STANDARD) + 2,
oledStringWidth(btnNo, FONT_STANDARD) + 2,
OLED_HEIGHT - 1); OLED_HEIGHT - 1);
} }
void layoutButtonYes(const char *btnYes) { void layoutButtonYes(const char *btnYes, const BITMAP *icon) {
oledDrawString(OLED_WIDTH - fontCharWidth(FONT_STANDARD, '\x06') - 1, int icon_width = 0;
OLED_HEIGHT - 8, "\x06", FONT_STANDARD); if (icon) {
oledDrawStringRight(OLED_WIDTH - fontCharWidth(FONT_STANDARD, '\x06') - 3, oledDrawBitmap(OLED_WIDTH - 8 - 1, OLED_HEIGHT - 8, icon);
OLED_HEIGHT - 8, btnYes, FONT_STANDARD); icon_width = icon->width;
oledInvert(OLED_WIDTH - oledStringWidth(btnYes, FONT_STANDARD) - }
fontCharWidth(FONT_STANDARD, '\x06') - 4, oledDrawStringRight(OLED_WIDTH - icon_width - 3, OLED_HEIGHT - 8, btnYes,
OLED_HEIGHT - 9, OLED_WIDTH - 1, OLED_HEIGHT - 1); 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, 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) { if (btnNo) {
layoutButtonNo(btnNo); layoutButtonNo(btnNo, &bmp_btn_cancel);
} }
if (btnYes) { if (btnYes) {
layoutButtonYes(btnYes); layoutButtonYes(btnYes, &bmp_btn_confirm);
} }
oledRefresh(); oledRefresh();
} }

View File

@ -24,8 +24,8 @@
#include <stdlib.h> #include <stdlib.h>
#include "bitmaps.h" #include "bitmaps.h"
void layoutButtonNo(const char *btnNo); void layoutButtonNo(const char *btnNo, const BITMAP *icon);
void layoutButtonYes(const char *btnYes); void layoutButtonYes(const char *btnYes, const BITMAP *icon);
void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes, 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,