Index: apps/misc.h
===================================================================
--- apps/misc.h (revision 14389)
+++ apps/misc.h (working copy)
@@ -91,6 +91,8 @@
bool list_stop_handler(void);
void car_adapter_mode_init(void);
extern int show_logo(void);
+/* custom user spash screen */
+extern int show_splash(void);
#if CONFIG_CODEC == SWCODEC
/* Return current ReplayGain mode a file should have (REPLAYGAIN_TRACK or
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 14389)
+++ apps/lang/english.lang (working copy)
@@ -11043,3 +11043,34 @@
*: "Only when viewing all types"
+
+ id: LANG_SHOW_SPLASH
+ desc: in settings_menu
+ user:
+
+ *: "Configure Splash Screen"
+
+
+ *: "Configure Splash Screen"
+
+
+ *: "Configure Splash Screen"
+
+
+
+ id: LANG_SET_AS_SPLASH
+ desc: text for onplay menu entry
+ user:
+
+ *: none
+ lcd_non-mono: "Set As Splash Screen"
+
+
+ *: none
+ lcd_non-mono: "Set As Splash Screen"
+
+
+ *: none
+ lcd_non-mono: "Set As Splash Screen"
+
+
Index: apps/onplay.c
===================================================================
--- apps/onplay.c (revision 14389)
+++ apps/onplay.c (working copy)
@@ -586,6 +586,15 @@
}
#endif
+#ifdef HAVE_LCD_BITMAP
+static bool set_splash(void)
+{
+ set_file(selected_file, (char *)global_settings.splash_file,
+ MAX_FILENAME);
+ return true;
+}
+#endif
+
static bool rename_file(void)
{
char newname[MAX_PATH];
@@ -1070,6 +1079,10 @@
MENUITEM_FUNCTION(set_backdrop_item, 0, ID2P(LANG_SET_AS_BACKDROP),
set_backdrop, NULL, clipboard_callback, Icon_NOICON);
#endif
+#ifdef HAVE_LCD_BITMAP
+MENUITEM_FUNCTION(set_splash_item, 0, ID2P(LANG_SET_AS_SPLASH),
+ set_splash, NULL, clipboard_callback, Icon_NOICON);
+#endif
#ifdef HAVE_RECORDING
static bool set_recdir(void)
{
@@ -1131,6 +1144,23 @@
return ACTION_EXIT_MENUITEM;
}
#endif
+#ifdef HAVE_LCD_BITMAP
+ else if (this_item == &set_splash_item)
+ {
+ if (selected_file)
+ {
+ char *suffix = strrchr(selected_file, '.');
+ if (suffix)
+ {
+ if (strcasecmp(suffix, ".bmp") == 0)
+ {
+ return action;
+ }
+ }
+ }
+ return ACTION_EXIT_MENUITEM;
+ }
+#endif
else if ((selected_file_attr & ATTR_DIRECTORY))
{
if ((this_item == &delete_dir_item)
@@ -1185,6 +1215,9 @@
#if LCD_DEPTH > 1
&set_backdrop_item,
#endif
+#ifdef HAVE_LCD_BITMAP
+ &set_splash_item,
+#endif
&list_viewers_item, &create_dir_item, &properties_item,
#ifdef HAVE_RECORDING
&set_recdir_item,
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 14389)
+++ apps/settings.h (working copy)
@@ -495,6 +495,11 @@
#ifdef HAVE_LCD_BITMAP
bool offset_out_of_view;
int screen_scroll_step;
+ /* custom user splash screen */
+ int splash_timeout; /* splash screen off timeout: 0-9 0=never,
+ then according to timeout_values[] */
+ unsigned char splash_file[MAX_FILENAME+1]; /* splash screen bitmap file */
+/* custom user splash screen */
#endif
/* auto bookmark settings */
Index: apps/menus/display_menu.c
===================================================================
--- apps/menus/display_menu.c (revision 14389)
+++ apps/menus/display_menu.c (working copy)
@@ -571,13 +571,19 @@
#endif
MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL);
+#ifdef HAVE_LCD_BITMAP
+/* custom user splash screen */
+/* MENUITEM_SETTING(show_splash, &global_settings.show_splash, NULL); */
+MENUITEM_SETTING(splash_timeout, &global_settings.splash_timeout, NULL);
+/* custom user splash screen */
+#endif
MENUITEM_SETTING(codepage_setting, &global_settings.default_codepage, NULL);
MAKE_MENU(display_menu, ID2P(LANG_DISPLAY),
NULL, Icon_Display_menu,
#ifdef HAVE_LCD_BITMAP
- &browse_fonts,
+ &splash_timeout, &browse_fonts,
#endif
&browse_wps,
#ifdef HAVE_REMOTE_LCD
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 14389)
+++ apps/settings_list.c (working copy)
@@ -204,6 +204,34 @@
#endif /* HAVE_RECORDING */
+#ifdef HAVE_LCD_BITMAP
+/* for custom user splash screen */
+static const char splash_times_conf [] =
+ "off,1,2,3,4,5,6,7,8,9";
+static const int splash_times[] =
+ {-1, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+static void splash_formatter(char *buffer, int buffer_size,
+ int val, const char *unit)
+{
+ (void)unit;
+ if (val == 0)
+ strcpy(buffer, str(LANG_OFF));
+ else if (val == 1)
+ strcpy(buffer, str(LANG_ON));
+ else
+ snprintf(buffer, buffer_size, "%d s", splash_times[val]);
+}
+static long splash_getlang(int value)
+{
+ if (value == 0)
+ return LANG_OFF;
+ else if (value == 1)
+ return LANG_ON;
+ return TALK_ID(splash_times[value], UNIT_SEC);
+}
+/* for custom user splash screen */
+#endif
+
#ifdef HAVE_BACKLIGHT
static const char backlight_times_conf [] =
"off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90";
@@ -473,6 +501,14 @@
"time format", "24hour,12hour", NULL, 2,
ID2P(LANG_24_HOUR_CLOCK), ID2P(LANG_12_HOUR_CLOCK)),
#endif
+
+/* custom user splash screen */
+ INT_SETTING_W_CFGVALS(F_FLIPLIST, splash_timeout, LANG_SHOW_SPLASH, 0,
+ "splash timeout", splash_times_conf, UNIT_SEC,
+ 0, 9, 1, splash_formatter, NULL,
+ NULL),
+/* custom user splash screen */
+
#endif /* HAVE_LCD_BITMAP */
OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL),
/* system */
@@ -1176,6 +1212,8 @@
"", BACKDROP_DIR "/", ".bmp", MAX_FILENAME+1),
#endif
#ifdef HAVE_LCD_BITMAP
+ FILENAME_SETTING(F_THEMESETTING,splash_file,"splash screen",
+ "", BACKDROP_DIR "/", ".bmp", MAX_FILENAME+1),
FILENAME_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd",MAX_FILENAME+1),
#endif
#ifdef HAVE_USB_POWER
Index: apps/main.c
===================================================================
--- apps/main.c (revision 14389)
+++ apps/main.c (working copy)
@@ -264,7 +264,10 @@
lcd_remote_init();
#endif
font_init();
+#ifndef HAVE_LCD_BITMAP
+/* like this for the custom splash screen */
show_logo();
+#endif
button_init();
backlight_init();
lang_init();
@@ -280,6 +283,17 @@
settings_apply();
init_dircache(true);
init_dircache(false);
+
+#ifdef HAVE_LCD_BITMAP
+/* just for the sim. This mimics the behaviour on target */
+ if(global_settings.splash_timeout < 1){
+ show_logo();
+ }else{
+ show_splash();
+ }
+/* custom user splash screen */
+#endif
+
#ifdef HAVE_TAGCACHE
init_tagcache();
#endif
@@ -352,7 +366,11 @@
#endif
font_init();
+#ifndef HAVE_LCD_BITMAP
+/* like this for the custom splash screen */
show_logo();
+#endif
+
lang_init();
#ifdef DEBUG
@@ -492,6 +510,13 @@
#endif
settings_load(SETTINGS_ALL);
+#ifdef HAVE_LCD_BITMAP
+/* custom user splash screen */
+ if(global_settings.splash_timeout < 1){
+ show_logo();
+ }
+#endif
+
if (init_dircache(true) < 0)
{
#ifdef HAVE_TAGCACHE
@@ -501,7 +526,15 @@
gui_sync_wps_init();
settings_apply();
+
+#ifdef HAVE_LCD_BITMAP
+/* custom user splash screen */
+ if(global_settings.splash_timeout > 0){
+ show_splash();
+ }
+#endif
init_dircache(false);
+
#ifdef HAVE_TAGCACHE
init_tagcache();
#endif
Index: apps/misc.c
===================================================================
--- apps/misc.c (revision 14389)
+++ apps/misc.c (working copy)
@@ -906,6 +906,32 @@
return default_event_handler_ex(event, NULL, NULL);
}
+
+#ifdef HAVE_LCD_BITMAP
+/* custom user splash */
+int show_splash( void )
+{
+ static fb_data save_buffer2[LCD_WIDTH*LCD_HEIGHT];
+ struct bitmap bm2;
+ char filename[MAX_PATH];
+ snprintf(filename, MAX_PATH, "%s/%s.bmp", BACKDROP_DIR, global_settings.splash_file);
+ bm2.data = (char*)save_buffer2;
+ int ret2 = read_bmp_file(filename, &bm2, LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data), FORMAT_NATIVE | FORMAT_DITHER);
+ if(ret2 < 0){
+ ret2 = read_bmp_file( "/.rockbox/splash.bmp", &bm2, LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data), FORMAT_NATIVE | FORMAT_DITHER);
+ }
+ if(ret2 <= 0 || (LCD_WIDTH < bm2.width || LCD_HEIGHT < bm2.height)){
+ show_logo();
+ }else{
+ lcd_bitmap(save_buffer2, (LCD_WIDTH-bm2.width)/2, (LCD_HEIGHT-bm2.height)/2, bm2.width, bm2.height);
+ lcd_update();
+ sleep(HZ*global_settings.splash_timeout);
+ }
+ return 0;
+}
+/* custom user splash */
+#endif
+
int show_logo( void )
{
#ifdef HAVE_LCD_BITMAP