@@ -1387,7 +1387,7 @@ void layoutShowPassphrase(const char *passphrase) {
13871387 const char * * str =
13881388 split_message ((const uint8_t * )passphrase , strlen (passphrase ), 21 );
13891389 for (int i = 0 ; i < 3 ; i ++ ) {
1390- oledDrawString (0 , ( i + 1 ) * 9 , str [i ], FONT_FIXED );
1390+ oledDrawString (0 , i * 9 + 4 , str [i ], FONT_FIXED );
13911391 }
13921392 oledDrawStringCenterAdapter (OLED_WIDTH / 2 , OLED_HEIGHT - 2 * 9 - 1 ,
13931393 _ ("Use this passphrase?" ), FONT_STANDARD );
@@ -1999,40 +1999,28 @@ void layoutProgressAdapter(const char *desc, int permil) {
19991999}
20002000
20012001void _layout_iterm_select (int x , int y , const BITMAP * bmp , const char * text ,
2002- uint8_t font , bool vert ) {
2002+ uint8_t font ) {
20032003 int l = 0 ;
20042004 int y0 = font & FONT_DOUBLE ? 8 : 0 ;
20052005 oledBox (x - 4 , y - 8 , x + 4 , y + 16 + y0 , false);
2006- oledDrawBitmap (x - 4 , y - 10 , & bmp_btn_up );
2006+ oledDrawBitmap (x - 4 , y - 8 , & bmp_btn_up );
20072007 l = oledStringWidth (text , font );
20082008 if (bmp ) {
20092009 oledDrawBitmap (x - 4 , y + 1 , bmp );
20102010 } else {
20112011 oledDrawStringAdapter (x - l / 2 , y , text , font );
2012- if (vert ) {
2013- oledInvert (x - l / 2 - 1 , y - 1 , x + l / 2 , y + 8 );
2014- oledClearPixel (x - l / 2 - 1 , y - 1 );
2015- oledClearPixel (x - l / 2 - 1 , y + 8 );
2016- oledClearPixel (x + l / 2 , y - 1 );
2017- oledClearPixel (x + l / 2 , y + 8 );
2018- }
20192012 }
20202013
2021- oledDrawBitmap (x - 4 , y + 11 + y0 , & bmp_btn_down );
2014+ oledDrawBitmap (x - 4 , y + 10 + y0 , & bmp_btn_down );
20222015 oledRefresh ();
20232016}
20242017
20252018void layoutItemsSelect (int x , int y , const char * text , uint8_t font ) {
2026- _layout_iterm_select (x , y , NULL , text , font , false);
2027- }
2028-
2029- void layoutItemsSelect_ex (int x , int y , const char * text , uint8_t font ,
2030- bool vert ) {
2031- _layout_iterm_select (x , y , NULL , text , font , vert );
2019+ _layout_iterm_select (x , y , NULL , text , font );
20322020}
20332021
20342022void layoutBmpSelect (int x , int y , const BITMAP * bmp ) {
2035- _layout_iterm_select (x , y , bmp , NULL , FONT_STANDARD , false );
2023+ _layout_iterm_select (x , y , bmp , NULL , FONT_STANDARD );
20362024}
20372025
20382026void layoutInputPin (uint8_t pos , const char * text , int index ,
@@ -2099,98 +2087,6 @@ void layoutInputWord(const char *text, uint8_t prefix_len, const char *prefix,
20992087
21002088 oledRefresh ();
21012089}
2102- static char * input [4 ] = {"abc" , "ABC" , "123" , "=/<" };
2103- static char * input1 [4 ] = {"ab" , "AB" , "01" , "=<" };
2104-
2105- void layoutInputMethod (uint8_t index ) {
2106- layoutItemsSelectAdapter (& bmp_btn_up , & bmp_btn_down , NULL , & bmp_btn_confirm ,
2107- NULL , _ ("OK" ), index + 1 , 4 , NULL , NULL ,
2108- input [index ], index > 0 ? input [index - 1 ] : NULL ,
2109- index < 3 ? input [index + 1 ] : NULL );
2110- }
2111-
2112- void layoutInputPassphrase (const char * text , uint8_t prefix_len ,
2113- const char * prefix , uint8_t char_index ,
2114- uint8_t input_type ) {
2115- int l , y = 10 ;
2116- char word_show [9 ] = "_________" ;
2117- char buf [2 ] = {0 };
2118- char index_str [16 ] = "" ;
2119- uint8_t location = 0 ;
2120-
2121- int x = 6 , icon_x = 80 ;
2122-
2123- if (prefix_len < 9 ) {
2124- memcpy (word_show , prefix , prefix_len );
2125- } else {
2126- memcpy (word_show , prefix + prefix_len - 8 , 8 );
2127- }
2128-
2129- oledClear_ex ();
2130-
2131- // index
2132- uint2str (prefix_len + 1 , index_str );
2133- strcat (index_str + strlen (index_str ), "/" );
2134- uint2str (50 , index_str + strlen (index_str ));
2135- oledDrawStringAdapter (1 , 1 , index_str , FONT_SMALL );
2136-
2137- // input type
2138- oledDrawString (icon_x , 1 , input [input_type ], FONT_SMALL );
2139-
2140- l = oledStringWidth (input [input_type ], FONT_SMALL );
2141-
2142- oledInvert (icon_x - 2 , 0 , icon_x + l , 6 );
2143- oledClearPixel (icon_x - 2 , 0 );
2144- oledClearPixel (icon_x - 2 , 6 );
2145- oledClearPixel (icon_x + l , 0 );
2146- oledClearPixel (icon_x + l , 6 );
2147- oledRefresh ();
2148-
2149- // title
2150- oledDrawStringCenterAdapter (OLED_WIDTH / 2 , y , text , FONT_STANDARD );
2151-
2152- y += 18 ;
2153- if (prefix_len < 9 ) {
2154- for (uint32_t i = 0 ; i < sizeof (word_show ); i ++ ) {
2155- buf [0 ] = word_show [i ];
2156- l = oledStringWidth (buf , FONT_STANDARD );
2157- oledDrawStringAdapter (x + 13 * i + 7 - l / 2 , y , buf , FONT_STANDARD );
2158- }
2159- } else {
2160- oledDrawStringAdapter (0 , y , ".." , FONT_STANDARD );
2161- for (uint32_t i = 0 ; i < sizeof (word_show ); i ++ ) {
2162- buf [0 ] = word_show [i ];
2163- l = oledStringWidth (buf , FONT_STANDARD );
2164- oledDrawStringAdapter (x + 13 * i + 7 - l / 2 , y , buf , FONT_STANDARD );
2165- }
2166- }
2167-
2168- location = prefix_len > 8 ? 8 : prefix_len ;
2169- if (char_index == 0 ) {
2170- layoutItemsSelect_ex (x + 13 * location + 7 , y , input1 [input_type ],
2171- FONT_STANDARD , true);
2172- layoutButtonYesAdapter (_ ("Switch" ), & bmp_btn_switch );
2173- } else if (char_index == 0xFF ) {
2174- layoutBmpSelect (x + 13 * location + 7 , y , & bmp_btn_confirm );
2175- layoutButtonYesAdapter (_ ("Submit" ), & bmp_btn_confirm );
2176- } else {
2177- buf [0 ] = char_index ;
2178- layoutItemsSelect_ex (x + 13 * location + 7 , y , buf , FONT_STANDARD , false);
2179- if (prefix_len == (MAX_PASSPHRASE_LEN - 1 )) {
2180- layoutButtonYesAdapter (_ ("Submit" ), & bmp_btn_confirm );
2181- } else {
2182- layoutButtonYesAdapter (_ ("Enter" ), & bmp_btn_confirm );
2183- }
2184- }
2185-
2186- if (prefix_len == 0 ) {
2187- layoutButtonNoAdapter (_ ("Quit" ), & bmp_btn_back );
2188- } else {
2189- layoutButtonNoAdapter (_ ("Back" ), & bmp_btn_back );
2190- }
2191-
2192- oledRefresh ();
2193- }
21942090
21952091void layoutItemsSelectAdapter (const BITMAP * bmp_up , const BITMAP * bmp_down ,
21962092 const BITMAP * bmp_no , const BITMAP * bmp_yes ,
@@ -2244,11 +2140,11 @@ void layoutItemsSelectAdapter(const BITMAP *bmp_up, const BITMAP *bmp_down,
22442140 oledDrawStringCenterAdapter (OLED_WIDTH / 2 , y1 , current , FONT_STANDARD );
22452141 }
22462142
2247- oledInvert (x - 2 , y1 - 1 , x + l + 1 , y1 + cur_font -> pixel );
2248- oledClearPixel (x - 2 , y1 - 1 );
2249- oledClearPixel (x - 2 , y1 + cur_font -> pixel );
2250- oledClearPixel (x + l + 1 , y1 - 1 );
2251- oledClearPixel (x + l + 1 , y1 + cur_font -> pixel );
2143+ oledInvert (x - 3 , y1 - 1 , x + l + 2 , y1 + cur_font -> pixel );
2144+ oledClearPixel (x - 3 , y1 - 1 );
2145+ oledClearPixel (x - 3 , y1 + cur_font -> pixel );
2146+ oledClearPixel (x + l + 2 , y1 - 1 );
2147+ oledClearPixel (x + l + 2 , y1 + cur_font -> pixel );
22522148
22532149 if (next ) {
22542150 oledDrawStringCenterAdapter (OLED_WIDTH / 2 , y1 + cur_font -> pixel + step ,
0 commit comments