Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

plugins: text viewer: use SBS title

Take advantage of skinned status bar title, instead of
displaying a custom header that reduces space for content.

A custom header will still be displayed if the SBS
doesn't come with its own title, such as on the default
theme, or if the status bar has been turned off in Text
Viewer's settings.

Change-Id: I14c8d9a61acf338d09d7f54947399e8692987a7b

+51 -3
+2
apps/plugin.c
··· 870 870 gesture_vel_get, 871 871 #endif 872 872 strstr, 873 + sb_set_title_text, 873 874 }; 874 875 875 876 static int plugin_buffer_handle; ··· 889 890 bool theme_enabled = sepch && (!strcmp("properties.rock", sepch + 1) || 890 891 !strcmp("playing_time.rock", sepch + 1) || 891 892 !strcmp("main_menu_config.rock", sepch + 1) || 893 + !strcmp("text_viewer.rock", sepch + 1) || 892 894 !strcmp("disktidy.rock", sepch + 1)); 893 895 894 896 if (current_plugin_handle)
+2
apps/plugin.h
··· 112 112 #include "menu.h" 113 113 #include "rbunicode.h" 114 114 #include "list.h" 115 + #include "statusbar-skinned.h" 115 116 #include "tree.h" 116 117 #include "color_picker.h" 117 118 #include "buflib.h" ··· 1020 1021 bool (*gesture_vel_get)(struct gesture_vel *gv, int *xvel, int *yvel); 1021 1022 #endif 1022 1023 char* (*strstr)(const char *s1, const char *s2); 1024 + bool (*sb_set_title_text)(const char* title, enum themable_icons icon, enum screen_type screen); 1023 1025 }; 1024 1026 1025 1027 /* plugin header */
+4
apps/plugins/text_viewer/tv_action.c
··· 76 76 /* select to read the page */ 77 77 tv_select_bookmark(); 78 78 79 + tv_update_sbs_title(); 80 + 79 81 return true; 80 82 } 81 83 ··· 188 190 off_t cur_file_pos = tv_get_screen_pos()->file_pos; 189 191 190 192 res = tv_display_menu(); 193 + 194 + tv_update_sbs_title(); 191 195 192 196 if (res == TV_MENU_RESULT_EXIT_MENU) 193 197 {
+26 -3
apps/plugins/text_viewer/tv_display.c
··· 69 69 70 70 static struct viewport vp_info; 71 71 static struct viewport vp_text; 72 - static bool is_initialized_vp = false; 72 + static bool is_initialized_vp; 73 + static bool sbs_has_title; 74 + #if LCD_DEPTH > 1 75 + static fb_data* backdrop; 76 + #endif 73 77 74 78 static struct screen* display; 75 79 ··· 90 94 91 95 static int totalsize; 92 96 97 + static bool tv_has_sbs_title(void) 98 + { 99 + return preferences->statusbar && sbs_has_title; 100 + } 101 + 93 102 static void tv_show_header(void) 94 103 { 95 - if (preferences->header_mode) 104 + /* Ignore header mode if we have an SBS title */ 105 + if (preferences->header_mode && !tv_has_sbs_title()) 96 106 display->putsxy(header.x, header.y, preferences->file_name); 97 107 } 98 108 ··· 189 199 display->set_viewport(&vp_info); 190 200 } 191 201 202 + bool tv_set_sbs_title(void) 203 + { 204 + sbs_has_title = rb->sb_set_title_text(preferences->file_name, Icon_NOICON, SCREEN_MAIN); 205 + return preferences->statusbar && sbs_has_title; 206 + } 207 + 192 208 void tv_start_display(void) 193 209 { 194 210 display->set_viewport(&vp_info); ··· 197 213 198 214 #if LCD_DEPTH > 1 199 215 if (preferences->night_mode) 216 + { 217 + backdrop = rb->lcd_get_backdrop(); 200 218 rb->lcd_set_backdrop(NULL); 219 + } 201 220 #endif 202 221 display->clear_viewport(); 203 222 ··· 207 226 { 208 227 display->update_viewport(); 209 228 display->set_viewport(NULL); 229 + #if LCD_DEPTH > 1 230 + if (preferences->night_mode) 231 + rb->lcd_set_backdrop(backdrop); 232 + #endif 210 233 } 211 234 212 235 void tv_set_layout(bool show_scrollbar) ··· 221 244 header.x = 0; 222 245 header.y = 0; 223 246 header.w = vp_info.width; 224 - header.h = (preferences->header_mode)? row_height + 1 : 0; 247 + header.h = (preferences->header_mode && !tv_set_sbs_title()) ? row_height + 1 : 0; 225 248 226 249 footer.x = 0; 227 250 footer.w = vp_info.width;
+8
apps/plugins/text_viewer/tv_display.h
··· 97 97 */ 98 98 void tv_init_scrollbar(off_t total, bool show_scrollbar); 99 99 100 + /* set the SBS title 101 + * 102 + * return 103 + * true, if title is displayed in SBS 104 + * false, if SBS is hidden or has no title 105 + */ 106 + bool tv_set_sbs_title(void); 107 + 100 108 /* start the display processing */ 101 109 void tv_start_display(void); 102 110
+6
apps/plugins/text_viewer/tv_window.c
··· 54 54 tv_show_bookmarks(disp_bookmarks, disp_count); 55 55 } 56 56 57 + void tv_update_sbs_title(void) 58 + { 59 + if (tv_set_sbs_title()) 60 + rb->send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); 61 + } 62 + 57 63 void tv_draw_window(void) 58 64 { 59 65 struct tv_screen_pos pos;
+3
apps/plugins/text_viewer/tv_window.h
··· 41 41 /* finalize the window module */ 42 42 void tv_finalize_window(void); 43 43 44 + /* update the skinned status bar title, if one is present */ 45 + void tv_update_sbs_title(void); 46 + 44 47 /* draw the display */ 45 48 void tv_draw_window(void); 46 49