diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/keymaps/keymap-h1x0_h3x0.c | 12 | ||||
-rw-r--r-- | apps/screens.c | 221 |
2 files changed, 133 insertions, 100 deletions
diff --git a/apps/keymaps/keymap-h1x0_h3x0.c b/apps/keymaps/keymap-h1x0_h3x0.c index 144b788323..0f5911aac7 100644 --- a/apps/keymaps/keymap-h1x0_h3x0.c +++ b/apps/keymaps/keymap-h1x0_h3x0.c | |||
@@ -710,6 +710,14 @@ static const struct button_mapping button_context_radio_h300lcdremote[] = { | |||
710 | }; | 710 | }; |
711 | 711 | ||
712 | 712 | ||
713 | static const struct button_mapping button_context_time_remote[] = { | ||
714 | { ACTION_STD_CANCEL, BUTTON_OFF, BUTTON_NONE }, | ||
715 | { ACTION_STD_OK, BUTTON_ON, BUTTON_NONE }, | ||
716 | { ACTION_SETTINGS_INC, BUTTON_RC_BITRATE, BUTTON_NONE }, | ||
717 | { ACTION_SETTINGS_DEC, BUTTON_RC_SOURCE, BUTTON_NONE }, | ||
718 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), | ||
719 | }; /* button_context_settings_bmark */ | ||
720 | |||
713 | /* the actual used tables */ | 721 | /* the actual used tables */ |
714 | static const struct button_mapping | 722 | static const struct button_mapping |
715 | *remote_btn_ctxt_std = 0, | 723 | *remote_btn_ctxt_std = 0, |
@@ -878,7 +886,9 @@ static const struct button_mapping* get_context_mapping_remote(int context) | |||
878 | return remote_btn_ctxt_listtree_scroll_w_cmb; | 886 | return remote_btn_ctxt_listtree_scroll_w_cmb; |
879 | case CONTEXT_CUSTOM|CONTEXT_TREE: | 887 | case CONTEXT_CUSTOM|CONTEXT_TREE: |
880 | return remote_btn_ctxt_tree; | 888 | return remote_btn_ctxt_tree; |
881 | 889 | case CONTEXT_SETTINGS_TIME: | |
890 | return remote_btn_ctxt_settingsgrph; | ||
891 | |||
882 | case CONTEXT_SETTINGS: | 892 | case CONTEXT_SETTINGS: |
883 | return remote_btn_ctxt_settings; | 893 | return remote_btn_ctxt_settings; |
884 | 894 | ||
diff --git a/apps/screens.c b/apps/screens.c index 2e9ab22d84..dddcbc61a9 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -86,44 +86,45 @@ void usb_screen(void) | |||
86 | /* nothing here! */ | 86 | /* nothing here! */ |
87 | #else | 87 | #else |
88 | int i; | 88 | int i; |
89 | bool statusbar = global_settings.statusbar; /* force the statusbar */ | ||
90 | global_settings.statusbar = true; | ||
89 | #if LCD_DEPTH > 1 | 91 | #if LCD_DEPTH > 1 |
90 | show_main_backdrop(); | 92 | show_main_backdrop(); |
91 | #endif | 93 | #endif |
92 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | 94 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 |
93 | show_remote_main_backdrop(); | 95 | show_remote_main_backdrop(); |
94 | #endif | 96 | #endif |
95 | |||
96 | FOR_NB_SCREENS(i) | 97 | FOR_NB_SCREENS(i) |
98 | { | ||
97 | screens[i].backlight_on(); | 99 | screens[i].backlight_on(); |
98 | 100 | screens[i].clear_display(); | |
99 | #ifdef HAVE_REMOTE_LCD | 101 | #if NB_SCREENS > 1 |
100 | lcd_remote_clear_display(); | 102 | if (i == SCREEN_REMOTE) |
101 | lcd_remote_bitmap(remote_usblogo, | 103 | { |
104 | screens[i].bitmap(remote_usblogo, | ||
102 | (LCD_REMOTE_WIDTH-BMPWIDTH_remote_usblogo), | 105 | (LCD_REMOTE_WIDTH-BMPWIDTH_remote_usblogo), |
103 | (LCD_REMOTE_HEIGHT-BMPHEIGHT_remote_usblogo)/2, | 106 | (LCD_REMOTE_HEIGHT-BMPHEIGHT_remote_usblogo)/2, |
104 | BMPWIDTH_remote_usblogo, BMPHEIGHT_remote_usblogo); | 107 | BMPWIDTH_remote_usblogo, BMPHEIGHT_remote_usblogo); |
105 | lcd_remote_update(); | 108 | } |
109 | else | ||
110 | { | ||
106 | #endif | 111 | #endif |
107 | |||
108 | lcd_clear_display(); | ||
109 | #ifdef HAVE_LCD_BITMAP | 112 | #ifdef HAVE_LCD_BITMAP |
110 | #ifdef HAVE_LCD_COLOR | 113 | screens[i].transparent_bitmap(usblogo, |
111 | lcd_bitmap_transparent(usblogo, (LCD_WIDTH-BMPWIDTH_usblogo), | 114 | (LCD_WIDTH-BMPWIDTH_usblogo), |
112 | (LCD_HEIGHT-BMPHEIGHT_usblogo)/2, | ||
113 | BMPWIDTH_usblogo, BMPHEIGHT_usblogo); | ||
114 | #else | ||
115 | lcd_bitmap(usblogo, (LCD_WIDTH-BMPWIDTH_usblogo), | ||
116 | (LCD_HEIGHT-BMPHEIGHT_usblogo)/2, | 115 | (LCD_HEIGHT-BMPHEIGHT_usblogo)/2, |
117 | BMPWIDTH_usblogo, BMPHEIGHT_usblogo); | 116 | BMPWIDTH_usblogo, BMPHEIGHT_usblogo); |
118 | #endif /* HAVE_LCD_COLOR */ | ||
119 | #else | 117 | #else |
120 | lcd_double_height(false); | 118 | screens[i].puts_scroll(0, 0, "[USB Mode]"); |
121 | lcd_puts_scroll(0, 0, "[USB Mode]"); | 119 | status_set_param(false); |
122 | status_set_param(false); | 120 | status_set_audio(false); |
123 | status_set_audio(false); | 121 | status_set_usb(true); |
124 | status_set_usb(true); | ||
125 | #endif /* HAVE_LCD_BITMAP */ | 122 | #endif /* HAVE_LCD_BITMAP */ |
126 | lcd_update(); | 123 | #if NB_SCREENS > 1 |
124 | } | ||
125 | #endif | ||
126 | screens[i].update(); | ||
127 | } | ||
127 | 128 | ||
128 | gui_syncstatusbar_draw(&statusbars, true); | 129 | gui_syncstatusbar_draw(&statusbars, true); |
129 | #ifdef SIMULATOR | 130 | #ifdef SIMULATOR |
@@ -144,6 +145,7 @@ void usb_screen(void) | |||
144 | #endif /* HAVE_LCD_CHARCELLS */ | 145 | #endif /* HAVE_LCD_CHARCELLS */ |
145 | FOR_NB_SCREENS(i) | 146 | FOR_NB_SCREENS(i) |
146 | screens[i].backlight_on(); | 147 | screens[i].backlight_on(); |
148 | global_settings.statusbar = statusbar; | ||
147 | #endif /* USB_NONE */ | 149 | #endif /* USB_NONE */ |
148 | } | 150 | } |
149 | 151 | ||
@@ -862,7 +864,7 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
862 | { | 864 | { |
863 | bool done = false; | 865 | bool done = false; |
864 | int button; | 866 | int button; |
865 | int i; | 867 | int i, s; |
866 | int cursorpos = 0; | 868 | int cursorpos = 0; |
867 | int lastcursorpos = !cursorpos; | 869 | int lastcursorpos = !cursorpos; |
868 | unsigned int julianday; | 870 | unsigned int julianday; |
@@ -922,10 +924,6 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
922 | str(dayname[tm->tm_wday]), tm->tm_year+1900, | 924 | str(dayname[tm->tm_wday]), tm->tm_year+1900, |
923 | str(monthname[tm->tm_mon]), tm->tm_mday); | 925 | str(monthname[tm->tm_mon]), tm->tm_mday); |
924 | 926 | ||
925 | /* recalculate the positions and offsets */ | ||
926 | lcd_getstringsize(title, &width, &prev_line_height); | ||
927 | lcd_getstringsize(buffer, &width, &line_height); | ||
928 | lcd_getstringsize(SEPARATOR, &separator_width, &height); | ||
929 | 927 | ||
930 | /* convert spaces in the buffer to \0 to make it possible to work | 928 | /* convert spaces in the buffer to \0 to make it possible to work |
931 | directly on the buffer */ | 929 | directly on the buffer */ |
@@ -935,83 +933,103 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
935 | buffer[9 + DAYNAME_LEN] = '\0'; | 933 | buffer[9 + DAYNAME_LEN] = '\0'; |
936 | buffer[14 + DAYNAME_LEN] = '\0'; | 934 | buffer[14 + DAYNAME_LEN] = '\0'; |
937 | buffer[15 + DAYNAME_LEN + MONTHNAME_LEN] = '\0'; | 935 | buffer[15 + DAYNAME_LEN + MONTHNAME_LEN] = '\0'; |
938 | 936 | FOR_NB_SCREENS(s) | |
939 | /* hour */ | ||
940 | lcd_getstringsize(buffer, &width, &height); | ||
941 | /* cursor[0][INDEX_X] is already 0 because of the memset */ | ||
942 | cursor[0][INDEX_Y] = prev_line_height + statusbar_height; | ||
943 | cursor[0][INDEX_WIDTH] = width; | ||
944 | |||
945 | /* minute */ | ||
946 | lcd_getstringsize(buffer + 3, &width, &height); | ||
947 | cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width; | ||
948 | cursor[1][INDEX_Y] = prev_line_height + statusbar_height; | ||
949 | cursor[1][INDEX_WIDTH] = width; | ||
950 | |||
951 | /* second */ | ||
952 | lcd_getstringsize(buffer + 6, &width, &height); | ||
953 | cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width + | ||
954 | cursor[1][INDEX_WIDTH] + separator_width; | ||
955 | cursor[2][INDEX_Y] = prev_line_height + statusbar_height; | ||
956 | |||
957 | /* weekday */ | ||
958 | lcd_getstringsize(buffer + 9, &weekday_width, &height); | ||
959 | lcd_getstringsize(" ", &separator_width, &height); | ||
960 | |||
961 | /* year */ | ||
962 | lcd_getstringsize(buffer + 10 + DAYNAME_LEN, &width, &height); | ||
963 | cursor[3][INDEX_X] = weekday_width + separator_width; | ||
964 | cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
965 | cursor[3][INDEX_WIDTH] = width; | ||
966 | |||
967 | /* month */ | ||
968 | lcd_getstringsize(buffer + 15 + DAYNAME_LEN, &width, &height); | ||
969 | cursor[4][INDEX_X] = weekday_width + 2 * separator_width + | ||
970 | cursor[3][INDEX_WIDTH]; | ||
971 | cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
972 | cursor[4][INDEX_WIDTH] = width; | ||
973 | |||
974 | /* day */ | ||
975 | lcd_getstringsize(buffer + 16 + DAYNAME_LEN + MONTHNAME_LEN, &width, &height); | ||
976 | cursor[5][INDEX_X] = weekday_width + 3 * separator_width + | ||
977 | cursor[3][INDEX_WIDTH] + | ||
978 | cursor[4][INDEX_WIDTH]; | ||
979 | cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
980 | |||
981 | /* draw the screen */ | ||
982 | lcd_set_drawmode(DRMODE_SOLID); | ||
983 | lcd_clear_display(); | ||
984 | /* display the screen title */ | ||
985 | lcd_puts_scroll(0, 0, title); | ||
986 | |||
987 | /* these are not selectable, so we draw them outside the loop */ | ||
988 | lcd_putsxy(0, cursor[3][INDEX_Y], buffer + 9); /* name of the week day */ | ||
989 | lcd_putsxy(cursor[1][INDEX_X] - separator_width, cursor[0][INDEX_Y], | ||
990 | SEPARATOR); | ||
991 | lcd_putsxy(cursor[2][INDEX_X] - separator_width, cursor[0][INDEX_Y], | ||
992 | SEPARATOR); | ||
993 | |||
994 | /* draw the selected item with drawmode set to | ||
995 | DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable | ||
996 | items with drawmode DRMODE_SOLID */ | ||
997 | for(i=0; i<6; i++) | ||
998 | { | 937 | { |
999 | if (cursorpos == i) | 938 | /* minimum lines needed is 2 + title line */ |
1000 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 939 | gui_textarea_update_nblines(&screens[s]); |
940 | if (screens[s].nb_lines < 4) | ||
941 | { | ||
942 | screens[s].setfont(FONT_SYSFIXED); | ||
943 | gui_textarea_update_nblines(&screens[s]); | ||
944 | } | ||
945 | |||
946 | /* recalculate the positions and offsets */ | ||
947 | if (screens[s].nb_lines >= 3) | ||
948 | screens[s].getstringsize(title, &width, &prev_line_height); | ||
1001 | else | 949 | else |
1002 | lcd_set_drawmode(DRMODE_SOLID); | 950 | prev_line_height = 0; |
951 | screens[s].getstringsize(buffer, &width, &line_height); | ||
952 | screens[s].getstringsize(SEPARATOR, &separator_width, &height); | ||
953 | |||
954 | /* hour */ | ||
955 | screens[s].getstringsize(buffer, &width, &height); | ||
956 | /* cursor[0][INDEX_X] is already 0 because of the memset */ | ||
957 | cursor[0][INDEX_Y] = prev_line_height + statusbar_height; | ||
958 | cursor[0][INDEX_WIDTH] = width; | ||
959 | |||
960 | /* minute */ | ||
961 | screens[s].getstringsize(buffer + 3, &width, &height); | ||
962 | cursor[1][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width; | ||
963 | cursor[1][INDEX_Y] = prev_line_height + statusbar_height; | ||
964 | cursor[1][INDEX_WIDTH] = width; | ||
965 | |||
966 | /* second */ | ||
967 | screens[s].getstringsize(buffer + 6, &width, &height); | ||
968 | cursor[2][INDEX_X] = cursor[0][INDEX_WIDTH] + separator_width + | ||
969 | cursor[1][INDEX_WIDTH] + separator_width; | ||
970 | cursor[2][INDEX_Y] = prev_line_height + statusbar_height; | ||
971 | |||
972 | /* weekday */ | ||
973 | screens[s].getstringsize(buffer + 9, &weekday_width, &height); | ||
974 | screens[s].getstringsize(" ", &separator_width, &height); | ||
975 | |||
976 | /* year */ | ||
977 | screens[s].getstringsize(buffer + 10 + DAYNAME_LEN, &width, &height); | ||
978 | cursor[3][INDEX_X] = weekday_width + separator_width; | ||
979 | cursor[3][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
980 | cursor[3][INDEX_WIDTH] = width; | ||
981 | |||
982 | /* month */ | ||
983 | screens[s].getstringsize(buffer + 15 + DAYNAME_LEN, &width, &height); | ||
984 | cursor[4][INDEX_X] = weekday_width + 2 * separator_width + | ||
985 | cursor[3][INDEX_WIDTH]; | ||
986 | cursor[4][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
987 | cursor[4][INDEX_WIDTH] = width; | ||
988 | |||
989 | /* day */ | ||
990 | screens[s].getstringsize(buffer + 16 + DAYNAME_LEN + MONTHNAME_LEN, | ||
991 | &width, &height); | ||
992 | cursor[5][INDEX_X] = weekday_width + 3 * separator_width + | ||
993 | cursor[3][INDEX_WIDTH] + | ||
994 | cursor[4][INDEX_WIDTH]; | ||
995 | cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; | ||
996 | |||
997 | /* draw the screen */ | ||
998 | screens[s].set_drawmode(DRMODE_SOLID); | ||
999 | screens[s].clear_display(); | ||
1000 | /* display the screen title */ | ||
1001 | screens[s].puts_scroll(0, 0, title); | ||
1002 | |||
1003 | /* these are not selectable, so we draw them outside the loop */ | ||
1004 | screens[s].putsxy(0, cursor[3][INDEX_Y], buffer + 9); /* name of the week day */ | ||
1005 | screens[s].putsxy(cursor[1][INDEX_X] - separator_width, | ||
1006 | cursor[0][INDEX_Y], SEPARATOR); | ||
1007 | screens[s].putsxy(cursor[2][INDEX_X] - separator_width, | ||
1008 | cursor[0][INDEX_Y], SEPARATOR); | ||
1009 | |||
1010 | /* draw the selected item with drawmode set to | ||
1011 | DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable | ||
1012 | items with drawmode DRMODE_SOLID */ | ||
1013 | for(i=0; i<6; i++) | ||
1014 | { | ||
1015 | if (cursorpos == i) | ||
1016 | screens[s].set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
1017 | else | ||
1018 | screens[s].set_drawmode(DRMODE_SOLID); | ||
1019 | |||
1020 | screens[s].putsxy(cursor[i][INDEX_X], | ||
1021 | cursor[i][INDEX_Y], ptr[i]); | ||
1022 | } | ||
1003 | 1023 | ||
1004 | lcd_putsxy(cursor[i][INDEX_X], cursor[i][INDEX_Y], ptr[i]); | 1024 | /* print help text */ |
1025 | if (screens[s].nb_lines > 4) | ||
1026 | screens[s].puts(0, 4, str(LANG_TIME_SET)); | ||
1027 | if (screens[s].nb_lines > 5) | ||
1028 | screens[s].puts(0, 5, str(LANG_TIME_REVERT)); | ||
1029 | screens[s].update(); | ||
1005 | } | 1030 | } |
1006 | |||
1007 | /* print help text */ | ||
1008 | lcd_puts(0, 4, str(LANG_TIME_SET)); | ||
1009 | lcd_puts(0, 5, str(LANG_TIME_REVERT)); | ||
1010 | |||
1011 | gui_syncstatusbar_draw(&statusbars, true); | 1031 | gui_syncstatusbar_draw(&statusbars, true); |
1012 | 1032 | ||
1013 | lcd_update(); | ||
1014 | |||
1015 | /* calculate the minimum and maximum for the number under cursor */ | 1033 | /* calculate the minimum and maximum for the number under cursor */ |
1016 | if(cursorpos!=lastcursorpos) { | 1034 | if(cursorpos!=lastcursorpos) { |
1017 | lastcursorpos=cursorpos; | 1035 | lastcursorpos=cursorpos; |
@@ -1050,7 +1068,7 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
1050 | say_time(cursorpos, tm); | 1068 | say_time(cursorpos, tm); |
1051 | } | 1069 | } |
1052 | 1070 | ||
1053 | button = get_action(CONTEXT_SETTINGS_TIME,HZ/2); | 1071 | button = get_action(CONTEXT_SETTINGS_TIME, TIMEOUT_BLOCK); |
1054 | switch ( button ) { | 1072 | switch ( button ) { |
1055 | case ACTION_STD_PREV: | 1073 | case ACTION_STD_PREV: |
1056 | cursorpos = (cursorpos + 6 - 1) % 6; | 1074 | cursorpos = (cursorpos + 6 - 1) % 6; |
@@ -1090,6 +1108,11 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
1090 | break; | 1108 | break; |
1091 | } | 1109 | } |
1092 | } | 1110 | } |
1111 | FOR_NB_SCREENS(i) | ||
1112 | { | ||
1113 | screens[i].setfont(FONT_UI); | ||
1114 | gui_textarea_update_nblines(&screens[i]); | ||
1115 | } | ||
1093 | action_signalscreenchange(); | 1116 | action_signalscreenchange(); |
1094 | return false; | 1117 | return false; |
1095 | } | 1118 | } |