From e991beed6df8700b41796c4c14ef786f45fb54c5 Mon Sep 17 00:00:00 2001 From: Kevin Ferrare Date: Wed, 16 Nov 2005 15:12:15 +0000 Subject: replaced all the splash calls by gui_sync_splash, added some missing remote key in the playlist viewer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7909 a1c6a512-1295-4272-9138-f99709370657 --- apps/alarm_menu.c | 7 +- apps/bookmark.c | 8 +-- apps/codecs.c | 6 +- apps/database.c | 25 +++---- apps/dbtree.c | 5 +- apps/debug_menu.c | 4 +- apps/filetree.c | 3 +- apps/filetypes.c | 17 ++--- apps/misc.c | 3 +- apps/onplay.c | 5 +- apps/playback.c | 9 +-- apps/playlist_viewer.c | 25 ++++++- apps/plugin.c | 15 ++-- apps/recorder/radio.c | 6 +- apps/recorder/recording.c | 6 +- apps/screens.c | 172 ++-------------------------------------------- apps/screens.h | 6 -- apps/settings_menu.c | 3 +- apps/sound_menu.c | 3 +- apps/wps-display.c | 6 +- apps/wps.c | 4 +- 21 files changed, 102 insertions(+), 236 deletions(-) (limited to 'apps') diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c index e8b421955c..9df664f8a8 100644 --- a/apps/alarm_menu.c +++ b/apps/alarm_menu.c @@ -43,6 +43,7 @@ #include "alarm_menu.h" #include "backlight.h" +#include "splash.h" #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) bool alarm_screen(void) @@ -92,11 +93,11 @@ bool alarm_screen(void) rtc_init(); rtc_set_alarm(h,m); rtc_enable_alarm(true); - splash(HZ*2, true, str(LANG_ALARM_MOD_TIME_TO_GO), + gui_syncsplash(HZ*2, true, str(LANG_ALARM_MOD_TIME_TO_GO), togo / 60, togo % 60); done = true; } else { - splash(HZ, true, str(LANG_ALARM_MOD_ERROR)); + gui_syncsplash(HZ, true, str(LANG_ALARM_MOD_ERROR)); update = true; } break; @@ -146,7 +147,7 @@ bool alarm_screen(void) case BUTTON_MENU: #endif rtc_enable_alarm(false); - splash(HZ*2, true, str(LANG_ALARM_MOD_DISABLE)); + gui_syncsplash(HZ*2, true, str(LANG_ALARM_MOD_DISABLE)); done = true; break; diff --git a/apps/bookmark.c b/apps/bookmark.c index 593bfe98cb..788aebe582 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -48,7 +48,7 @@ #include "talk.h" #include "misc.h" #include "abrepeat.h" - +#include "splash.h" #define MAX_BOOKMARKS 10 #define MAX_BOOKMARK_SIZE 350 #define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark" @@ -283,9 +283,9 @@ static bool write_bookmark(bool create_bookmark_file) } if (success) - splash(HZ, true, str(LANG_BOOKMARK_CREATE_SUCCESS)); + gui_syncsplash(HZ, true, str(LANG_BOOKMARK_CREATE_SUCCESS)); else - splash(HZ, true, str(LANG_BOOKMARK_CREATE_FAILURE)); + gui_syncsplash(HZ, true, str(LANG_BOOKMARK_CREATE_FAILURE)); return true; } @@ -621,7 +621,7 @@ static char* select_bookmark(const char* bookmark_file_name) /* if there were no bookmarks in the file, delete the file and exit. */ if(bookmark_id <= 0) { - splash(HZ, true, str(LANG_BOOKMARK_LOAD_EMPTY)); + gui_syncsplash(HZ, true, str(LANG_BOOKMARK_LOAD_EMPTY)); remove(bookmark_file_name); return NULL; } diff --git a/apps/codecs.c b/apps/codecs.c index a227eb1fc4..e443127208 100644 --- a/apps/codecs.c +++ b/apps/codecs.c @@ -48,6 +48,8 @@ #include "system.h" #include "sound.h" #include "database.h" +#include "splash.h" + #if (CONFIG_CODEC == SWCODEC) #include "pcm_playback.h" #endif @@ -94,7 +96,7 @@ struct codec_api ci = { NULL, NULL, - splash, + gui_syncsplash, /* file */ (open_func)PREFIX(open), @@ -304,7 +306,7 @@ int codec_load_file(const char *plugin, struct codec_api *api) if (fd < 0) { snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin); logf("Codec load error:%d", fd); - splash(HZ*2, true, msgbuf); + gui_syncsplash(HZ*2, true, msgbuf); return fd; } diff --git a/apps/database.c b/apps/database.c index a84baa2a5c..6d74ce88a9 100644 --- a/apps/database.c +++ b/apps/database.c @@ -43,6 +43,7 @@ #include "keyboard.h" #include "database.h" #include "autoconf.h" +#include "splash.h" #if CONFIG_CODEC == SWCODEC #include "playback.h" @@ -94,7 +95,7 @@ int tagdb_init(void) ptr[1] != 'D' || ptr[2] != 'B') { - splash(HZ,true,"Not a rockbox ID3 database!"); + gui_syncsplash(HZ,true,"Not a rockbox ID3 database!"); return -1; } #ifdef ROCKBOX_LITTLE_ENDIAN @@ -106,7 +107,7 @@ int tagdb_init(void) #endif if ( (tagdbheader.version&0xFF) != TAGDB_VERSION) { - splash(HZ,true,"Unsupported database version %d!", + gui_syncsplash(HZ,true,"Unsupported database version %d!", tagdbheader.version&0xFF); return -1; } @@ -115,7 +116,7 @@ int tagdb_init(void) tagdbheader.albumstart > tagdbheader.songstart || tagdbheader.artiststart > tagdbheader.albumstart) { - splash(HZ,true,"Corrupt ID3 database!"); + gui_syncsplash(HZ,true,"Corrupt ID3 database!"); return -1; } @@ -232,7 +233,7 @@ void update_fentryoffsets(int start, int end) } } if(fe.rundbentry!=-1) { - splash(HZ*2,true, "o.o.. found a rundbentry? o.o; didn't update " + gui_syncsplash(HZ*2,true, "o.o.. found a rundbentry? o.o; didn't update " "it, update the code o.o;"); } } @@ -242,7 +243,7 @@ int tagdb_shiftdown(int targetoffset, int startingoffset, int bytes) { int amount; if(targetoffset>=startingoffset) { - splash(HZ*2,true,"Woah. no beeping way. (tagdb_shiftdown)"); + gui_syncsplash(HZ*2,true,"Woah. no beeping way. (tagdb_shiftdown)"); return 0; } lseek(tagdb_fd,startingoffset,SEEK_SET); @@ -253,7 +254,7 @@ int tagdb_shiftdown(int targetoffset, int startingoffset, int bytes) written=write(tagdb_fd,sbuf,amount); targetoffset+=written; if(amount!=written) { - splash(HZ*2,true,"Something went very wrong. expect database " + gui_syncsplash(HZ*2,true,"Something went very wrong. expect database " "corruption. (tagdb_shiftdown)"); return 0; } @@ -268,7 +269,7 @@ int tagdb_shiftup(int targetoffset, int startingoffset, int bytes) int amount,amount2; int readpos,writepos,filelen; if(targetoffset<=startingoffset) { - splash(HZ*2,true,"Um. no. (tagdb_shiftup)"); + gui_syncsplash(HZ*2,true,"Um. no. (tagdb_shiftup)"); return 0; } filelen=lseek(tagdb_fd,0,SEEK_END); @@ -280,14 +281,14 @@ int tagdb_shiftup(int targetoffset, int startingoffset, int bytes) lseek(tagdb_fd,readpos,SEEK_SET); amount2=read(tagdb_fd,sbuf,amount); if(amount2!=amount) { - splash(HZ*2,true,"Something went very wrong. expect database " + gui_syncsplash(HZ*2,true,"Something went very wrong. expect database " "corruption. (tagdb_shiftup)"); return 0; } lseek(tagdb_fd,writepos,SEEK_SET); amount=write(tagdb_fd,sbuf,amount2); if(amount2!=amount) { - splash(HZ*2,true,"Something went very wrong. expect database " + gui_syncsplash(HZ*2,true,"Something went very wrong. expect database " "corruption. (tagdb_shiftup)"); return 0; } @@ -296,7 +297,7 @@ int tagdb_shiftup(int targetoffset, int startingoffset, int bytes) if(bytes==0) return 1; else { - splash(HZ*2,true,"Something went wrong, >.>;; (tagdb_shiftup)"); + gui_syncsplash(HZ*2,true,"Something went wrong, >.>;; (tagdb_shiftup)"); return 0; } } @@ -361,7 +362,7 @@ int rundb_init(void) ptr[1] != 'R' || ptr[2] != 'D') { - splash(HZ,true,"Not a rockbox runtime database!"); + gui_syncsplash(HZ,true,"Not a rockbox runtime database!"); return -1; } #ifdef ROCKBOX_LITTLE_ENDIAN @@ -373,7 +374,7 @@ int rundb_init(void) #endif if ( (rundbheader.version&0xFF) != RUNDB_VERSION) { - splash(HZ,true,"Unsupported runtime database version %d!", + gui_syncsplash(HZ,true,"Unsupported runtime database version %d!", rundbheader.version&0xFF); return -1; } diff --git a/apps/dbtree.c b/apps/dbtree.c index 9ea0706245..9115c5902c 100644 --- a/apps/dbtree.c +++ b/apps/dbtree.c @@ -44,6 +44,7 @@ #include "keyboard.h" #include "autoconf.h" #include "list.h" +#include "splash.h" static int db_play_folder(struct tree_context* c); static int db_search(struct tree_context* c, char* string); @@ -130,13 +131,13 @@ int db_load(struct tree_context* c) i = db_search(c, searchstring); c->dirlength = c->filesindir = i; if (c->dirfull) { - splash(HZ, true, "%s %s", + gui_syncsplash(HZ, true, "%s %s", str(LANG_SHOWDIR_ERROR_BUFFER), str(LANG_SHOWDIR_ERROR_FULL)); c->dirfull = false; } else - splash(HZ, true, str(LANG_ID3DB_MATCHES), i); + gui_syncsplash(HZ, true, str(LANG_ID3DB_MATCHES), i); return i; case allsongs: diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 79448b14aa..1364637ab0 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -47,6 +47,8 @@ #include "panic.h" #include "screens.h" #include "misc.h" +#include "splash.h" + #ifdef HAVE_LCD_BITMAP #include "widgets.h" #include "peakmeter.h" @@ -1748,7 +1750,7 @@ extern bool do_screendump_instead_of_usb; bool dbg_screendump(void) { do_screendump_instead_of_usb = !do_screendump_instead_of_usb; - splash(HZ, true, "Screendump %s", + gui_syncsplash(HZ, true, "Screendump %s", do_screendump_instead_of_usb?"enabled":"disabled"); return false; } diff --git a/apps/filetree.c b/apps/filetree.c index 8a365cc574..a873d85f1c 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -39,6 +39,7 @@ #include "rolo.h" #include "sprintf.h" #include "dircache.h" +#include "splash.h" #ifndef SIMULATOR static int boot_size = 0; @@ -406,7 +407,7 @@ int ft_enter(struct tree_context* c) set_file(buf, global_settings.lang_file, MAX_FILENAME); talk_init(); /* use voice of same language */ - splash(HZ, true, str(LANG_LANGUAGE_LOADED)); + gui_syncsplash(HZ, true, str(LANG_LANGUAGE_LOADED)); } break; diff --git a/apps/filetypes.c b/apps/filetypes.c index d5a900317f..e2240089ce 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -35,6 +35,7 @@ #include "dir.h" #include "file.h" #include "icons.h" +#include "splash.h" /* max plugin name size without extensions and path */ #define MAX_PLUGIN_LENGTH 32 @@ -316,14 +317,14 @@ static void scan_plugins(void) /* exttypes[] full, bail out */ if (cnt_exttypes >= MAX_EXTTYPES) { - splash(HZ,true,str(LANG_FILETYPES_EXTENSION_FULL)); + gui_syncsplash(HZ,true,str(LANG_FILETYPES_EXTENSION_FULL)); break; } /* filetypes[] full, bail out */ if (cnt_filetypes >= MAX_FILETYPES) { - splash(HZ,true,str(LANG_FILETYPES_FULL)); + gui_syncsplash(HZ,true,str(LANG_FILETYPES_FULL)); break; } @@ -356,7 +357,7 @@ static void scan_plugins(void) /* filter out to long filenames */ if (strlen(entry->d_name) > MAX_PLUGIN_LENGTH + 5) { - splash(HZ,true,str(LANG_FILETYPES_PLUGIN_NAME_LONG)); + gui_syncsplash(HZ,true,str(LANG_FILETYPES_PLUGIN_NAME_LONG)); continue; } @@ -537,13 +538,13 @@ bool read_config(const char* file) { if (cnt_exttypes >= MAX_EXTTYPES) { - splash(HZ,true,str(LANG_FILETYPES_EXTENSION_FULL)); + gui_syncsplash(HZ,true,str(LANG_FILETYPES_EXTENSION_FULL)); break; } if (cnt_filetypes >= MAX_FILETYPES) { - splash(HZ,true,str(LANG_FILETYPES_FULL)); + gui_syncsplash(HZ,true,str(LANG_FILETYPES_FULL)); break; } @@ -612,7 +613,7 @@ bool read_config(const char* file) { if (strlen(str[plugin]) > MAX_PLUGIN_LENGTH) { - splash(HZ, true, str(LANG_FILETYPES_PLUGIN_NAME_LONG)); + gui_syncsplash(HZ, true, str(LANG_FILETYPES_PLUGIN_NAME_LONG)); str[plugin] = NULL; continue; } @@ -712,7 +713,7 @@ static char* string2icon(const char* str) (unsigned long) string_buffer - (unsigned long) next_free_string) < ICON_LENGTH) { - splash(HZ,true,str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); + gui_syncsplash(HZ,true,str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); return NULL; } @@ -768,7 +769,7 @@ static char* get_string(const char* str) } else { - splash(HZ,true,str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); + gui_syncsplash(HZ,true,str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); return NULL; } } diff --git a/apps/misc.c b/apps/misc.c index a91a1a250f..986a52ccb5 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -43,6 +43,7 @@ #include "atoi.h" #include "version.h" #include "font.h" +#include "splash.h" #ifdef HAVE_MMC #include "ata_mmc.h" #endif @@ -442,7 +443,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) #endif { lcd_clear_display(); - splash(0, true, str(LANG_SHUTTINGDOWN)); + gui_syncsplash(0, true, str(LANG_SHUTTINGDOWN)); if (callback != NULL) callback(parameter); diff --git a/apps/onplay.c b/apps/onplay.c index c71a75ac6d..36ea95771a 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -48,6 +48,7 @@ #include "bookmark.h" #include "wps.h" #include "action.h" +#include "splash.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" #endif @@ -125,7 +126,7 @@ static bool list_viewers(void) } else { - splash(HZ*2, true, "No viewers found"); + gui_syncsplash(HZ*2, true, "No viewers found"); } if (ret == PLUGIN_USB_CONNECTED) @@ -495,7 +496,7 @@ bool create_dir(void) rc = mkdir(dirname, 0); if (rc < 0) { - splash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED)); + gui_syncsplash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED)); } else { onplay_result = ONPLAY_RELOAD_DIR; } diff --git a/apps/playback.c b/apps/playback.c index 37a86d511c..7f28331b75 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -65,6 +65,7 @@ #include "radio.h" #include "power.h" #endif +#include "splash.h" static volatile bool audio_codec_loaded; static volatile bool voice_codec_loaded; @@ -918,7 +919,7 @@ bool loadcodec(const char *trackname, bool start_play) default: logf("Codec: Unsupported"); snprintf(msgbuf, sizeof(msgbuf)-1, "No codec for: %s", trackname); - splash(HZ*2, true, msgbuf); + gui_syncsplash(HZ*2, true, msgbuf); codec_path = NULL; } @@ -952,7 +953,7 @@ bool loadcodec(const char *trackname, bool start_play) if (fd < 0) { logf("Codec doesn't exist!"); snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", codec_path); - splash(HZ*2, true, msgbuf); + gui_syncsplash(HZ*2, true, msgbuf); return false; } @@ -1872,7 +1873,7 @@ void codec_thread(void) if (status != CODEC_OK) { logf("Codec failure"); audio_stop_playback(); - splash(HZ*2, true, "Codec failure"); + gui_syncsplash(HZ*2, true, "Codec failure"); } else { logf("Codec finished"); } @@ -2266,7 +2267,7 @@ void audio_set_crossfade(int enable) /* Re-initialize audio system. */ if (was_playing) - splash(0, true, str(LANG_RESTARTING_PLAYBACK)); + gui_syncsplash(0, true, str(LANG_RESTARTING_PLAYBACK)); pcmbuf_init(size); pcmbuf_crossfade_enable(enable); reset_buffer(); diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 36acb9b897..3f0e27d9e9 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -673,15 +673,30 @@ bool playlist_viewer_ex(char* filename) switch (button) { case TREE_EXIT: +#ifdef TREE_RC_EXIT + case TREE_RC_EXIT: +#endif #ifdef TREE_OFF - case TREE_OFF: + case TREE_OFF: #endif exit = true; break; +#ifdef TREE_ENTER + case TREE_ENTER: + case TREE_ENTER | BUTTON_REPEAT: +#endif +#ifdef TREE_RC_RUN + case TREE_RC_RUN: +#endif case TREE_RUN: #ifdef TREE_RUN_PRE - if (lastbutton != TREE_RUN_PRE) + if (((button == TREE_RUN) +#ifdef TREE_RC_RUN_PRE + || (button == TREE_RC_RUN)) + && ((lastbutton != TREE_RC_RUN_PRE) +#endif + && (lastbutton != TREE_RUN_PRE))) break; #endif struct playlist_entry * current_track=playlist_buffer_get_track(&viewer.buffer, viewer.selected_track); @@ -722,6 +737,9 @@ bool playlist_viewer_ex(char* filename) case TREE_CONTEXT: #ifdef TREE_CONTEXT2 case TREE_CONTEXT2: +#endif +#ifdef TREE_RC_CONTEXT + case TREE_RC_CONTEXT: #endif { /* ON+PLAY menu */ @@ -747,6 +765,9 @@ bool playlist_viewer_ex(char* filename) } case TREE_MENU: +#ifdef TREE_RC_MENU + case TREE_RC_MENU: +#endif if (viewer_menu()) { ret = true; diff --git a/apps/plugin.c b/apps/plugin.c index b1560c7182..a30b089e55 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -48,6 +48,7 @@ #include "timer.h" #include "sound.h" #include "database.h" +#include "splash.h" #if (CONFIG_CODEC == SWCODEC) #include "pcm_playback.h" #endif @@ -138,7 +139,7 @@ static const struct plugin_api rockbox_api = { backlight_on, backlight_off, backlight_set_timeout, - splash, + gui_syncsplash, #ifdef HAVE_REMOTE_LCD /* remote lcd */ lcd_remote_set_contrast, @@ -400,7 +401,7 @@ int plugin_load(const char* plugin, void* parameter) fd = open(plugin, O_RDONLY); if (fd < 0) { snprintf(buf, sizeof buf, str(LANG_PLUGIN_CANT_OPEN), plugin); - splash(HZ*2, true, buf); + gui_syncsplash(HZ*2, true, buf); return fd; } @@ -413,12 +414,12 @@ int plugin_load(const char* plugin, void* parameter) if (plugin_size < 0) { /* read error */ snprintf(buf, sizeof buf, str(LANG_READ_FAILED), plugin); - splash(HZ*2, true, buf); + gui_syncsplash(HZ*2, true, buf); return -1; } if (plugin_size == 0) { /* loaded a 0-byte plugin, implying it's not for this model */ - splash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); + gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); return -1; } #endif @@ -450,15 +451,15 @@ int plugin_load(const char* plugin, void* parameter) return PLUGIN_USB_CONNECTED; case PLUGIN_WRONG_API_VERSION: - splash(HZ*2, true, str(LANG_PLUGIN_WRONG_VERSION)); + gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_VERSION)); break; case PLUGIN_WRONG_MODEL: - splash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); + gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); break; default: - splash(HZ*2, true, str(LANG_PLUGIN_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_ERROR)); break; } diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index fa0f091156..1c54602e73 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -814,7 +814,7 @@ bool radio_screen(void) #ifndef SIMULATOR if(audio_status() & AUDIO_STATUS_ERROR) { - splash(0, true, str(LANG_DISK_FULL)); + gui_syncsplash(0, true, str(LANG_DISK_FULL)); gui_syncstatusbar_draw(&statusbars,true); FOR_NB_SCREENS(i) gui_textarea_update(&screens[i]); @@ -878,7 +878,7 @@ void radio_save_presets(void) } else { - splash(HZ*2, true, str(LANG_FM_PRESET_SAVE_FAILED)); + gui_syncsplash(HZ*2, true, str(LANG_FM_PRESET_SAVE_FAILED)); } } @@ -959,7 +959,7 @@ bool radio_add_preset(void) } else { - splash(HZ*2, true, str(LANG_FM_NO_FREE_PRESETS)); + gui_syncsplash(HZ*2, true, str(LANG_FM_NO_FREE_PRESETS)); } return true; } diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 62b5dff489..eda56a5bf9 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -59,7 +59,7 @@ #include "atoi.h" #include "sound.h" #include "ata.h" - +#include "splash.h" #ifdef HAVE_RECORDING @@ -228,7 +228,7 @@ int rec_create_directory(void) rc = mkdir(rec_base_directory, 0); if(rc < 0 && errno != EEXIST) { - splash(HZ * 2, true, + gui_syncsplash(HZ * 2, true, "Can't create the %s directory. Error code %d.", rec_base_directory, rc); return -1; @@ -859,7 +859,7 @@ bool recording_screen(void) #endif if (audio_stat & AUDIO_STATUS_ERROR) { - splash(0, true, str(LANG_DISK_FULL)); + gui_syncsplash(0, true, str(LANG_DISK_FULL)); status_draw(true); lcd_update(); audio_error_clear(); diff --git a/apps/screens.c b/apps/screens.c index f3e00dfc0a..978d2a12f8 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -47,6 +47,7 @@ #include "sound.h" #include "abrepeat.h" #include "wps-display.h" +#include "splash.h" #if defined(HAVE_LCD_BITMAP) #include "widgets.h" #endif @@ -155,7 +156,7 @@ int mmc_remove_request(void) struct event ev; lcd_clear_display(); - splash(1, true, str(LANG_REMOVE_MMC)); + gui_syncsplash(1, true, str(LANG_REMOVE_MMC)); if (global_settings.talk_menu) talk_id(LANG_REMOVE_MMC, false); @@ -771,175 +772,10 @@ bool quick_screen(int context, int button) } #endif -#ifdef HAVE_LCD_BITMAP -#define SPACE 3 /* pixels between words */ -#define MAXLETTERS 128 /* 16*8 */ -#define MAXLINES 10 -#else -#define SPACE 1 /* one letter space */ -#undef LCD_WIDTH -#define LCD_WIDTH 11 -#undef LCD_HEIGHT -#define LCD_HEIGHT 2 -#define MAXLETTERS 22 /* 11 * 2 */ -#define MAXLINES 2 -#endif - -void splash(int ticks, /* how long the splash is displayed */ - bool center, /* FALSE means left-justified, TRUE means - horizontal and vertical center */ - const char *fmt, /* what to say *printf style */ - ...) -{ - char *next; - char *store=NULL; - int x=0; - int y=0; - int w, h; - unsigned char splash_buf[MAXLETTERS]; - va_list ap; - unsigned char widths[MAXLINES]; - int line=0; - bool first=true; -#ifdef HAVE_LCD_BITMAP - int maxw=0; -#endif - -#ifdef HAVE_LCD_CHARCELLS - lcd_double_height (false); -#endif - va_start( ap, fmt ); - vsnprintf( splash_buf, sizeof(splash_buf), fmt, ap ); - - if(center) { - - /* first a pass to measure sizes */ - next = strtok_r(splash_buf, " ", &store); - while (next) { -#ifdef HAVE_LCD_BITMAP - lcd_getstringsize(next, &w, &h); -#else - w = strlen(next); - h = 1; /* store height in characters */ -#endif - if(!first) { - if(x+w> LCD_WIDTH) { - /* Too wide, wrap */ - y+=h; - line++; - if((y > (LCD_HEIGHT-h)) || (line > MAXLINES)) - /* STOP */ - break; - x=0; - first=true; - } - } - else - first = false; - - /* think of it as if the text was written here at position x,y - being w pixels/chars wide and h high */ - - x += w+SPACE; - widths[line]=x-SPACE; /* don't count the trailing space */ -#ifdef HAVE_LCD_BITMAP - /* store the widest line */ - if(widths[line]>maxw) - maxw = widths[line]; -#endif - next = strtok_r(NULL, " ", &store); - } -#ifdef HAVE_LCD_BITMAP - /* Start displaying the message at position y. The reason for the - added h here is that it isn't added until the end of lines in the - loop above and we always break the loop in the middle of a line. */ - y = (LCD_HEIGHT - (y+h) )/2; -#else - y = 0; /* vertical center on 2 lines would be silly */ -#endif - first=true; - - /* Now recreate the string again since the strtok_r() above has ruined - the one we already have! Here's room for improvements! */ - vsnprintf( splash_buf, sizeof(splash_buf), fmt, ap ); - } - va_end( ap ); - - if(center) - { - x = (LCD_WIDTH-widths[0])/2; - if(x < 0) - x = 0; - } - -#ifdef HAVE_LCD_BITMAP - /* If we center the display, then just clear the box we need and put - a nice little frame and put the text in there! */ - if(center && (y > 2)) { - int xx = (LCD_WIDTH-maxw)/2 - 2; - /* The new graphics routines handle clipping, so no need to check */ -#if LCD_DEPTH > 1 - lcd_set_background(LCD_LIGHTGRAY); -#endif - lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); - lcd_fillrect(xx, y-2, maxw+4, LCD_HEIGHT-y*2+4); - lcd_set_drawmode(DRMODE_SOLID); - lcd_drawrect(xx, y-2, maxw+4, LCD_HEIGHT-y*2+4); - } - else -#endif - lcd_clear_display(); - line=0; - next = strtok_r(splash_buf, " ", &store); - while (next) { -#ifdef HAVE_LCD_BITMAP - lcd_getstringsize(next, &w, &h); -#else - w = strlen(next); - h = 1; -#endif - if(!first) { - if(x+w> LCD_WIDTH) { - /* too wide */ - y+=h; - line++; /* goto next line */ - first=true; - if(y > (LCD_HEIGHT-h)) - /* STOP */ - break; - if(center) { - x = (LCD_WIDTH-widths[line])/2; - if(x < 0) - x = 0; - } - else - x=0; - } - } - else - first=false; -#ifdef HAVE_LCD_BITMAP - lcd_putsxy(x, y, next); -#else - lcd_puts(x, y, next); -#endif - x += w+SPACE; /* pixels space! */ - next = strtok_r(NULL, " ", &store); - } -#if LCD_DEPTH > 1 - lcd_set_background(LCD_WHITE); -#endif - lcd_update(); - - if(ticks) - /* unbreakable! */ - sleep(ticks); -} - #if defined(HAVE_CHARGING) || defined(SIMULATOR) void charging_splash(void) { - splash(2*HZ, true, str(LANG_BATTERY_CHARGE)); + gui_syncsplash(2*HZ, true, str(LANG_BATTERY_CHARGE)); button_clear_queue(); } #endif @@ -1254,7 +1090,7 @@ bool shutdown_screen(void) lcd_stop_scroll(); - splash(0, true, str(LANG_CONFIRM_SHUTDOWN)); + gui_syncsplash(0, true, str(LANG_CONFIRM_SHUTDOWN)); while(!done) { diff --git a/apps/screens.h b/apps/screens.h index 7a1b3f32bb..60a1537e99 100644 --- a/apps/screens.h +++ b/apps/screens.h @@ -43,12 +43,6 @@ bool quick_screen(const int, const int); /* Long press already detected so not needed here */ #endif -void splash(int ticks, /* how long */ - bool center, /* FALSE means left-justified, TRUE means - horizontal and vertical center */ - const char *fmt, /* what to say *printf style */ - ...); - #ifdef HAVE_RTC bool set_time_screen(const char* string, struct tm *tm); #endif diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 9b6ee931fd..4aea853f82 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -51,6 +51,7 @@ #include "database.h" #include "dir.h" #include "dircache.h" +#include "splash.h" #ifdef HAVE_LCD_BITMAP #include "peakmeter.h" @@ -1337,7 +1338,7 @@ static bool dircache(void) NULL); if (!dircache_is_enabled() && global_settings.dircache) - splash(HZ*2, true, str(LANG_DIRCACHE_REBOOT)); + gui_syncsplash(HZ*2, true, str(LANG_DIRCACHE_REBOOT)); if (!result) dircache_disable(); diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 833dea53b9..f2d92d6df6 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c @@ -42,6 +42,7 @@ #include "peakmeter.h" #include "mas.h" #endif +#include "splash.h" int selected_setting; /* Used by the callback */ void dec_sound_formatter(char *buffer, int buffer_size, int val, const char * unit) @@ -610,7 +611,7 @@ bool rectrigger(void) switch (button) { case TRIG_CANCEL: - splash(50, true, str(LANG_RESET_DONE_CANCEL)); + gui_syncsplash(50, true, str(LANG_RESET_DONE_CANCEL)); global_settings.rec_start_thres = old_start_thres; global_settings.rec_start_duration = old_start_duration; global_settings.rec_prerecord_time = old_prerecord_time; diff --git a/apps/wps-display.c b/apps/wps-display.c index 4647ce9b60..58a953e4c0 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c @@ -47,7 +47,7 @@ #include "button.h" #include "abrepeat.h" #include "screens.h" - +#include "splash.h" #ifdef HAVE_LCD_BITMAP #include #include "icons.h" @@ -1622,10 +1622,10 @@ bool wps_display(struct mp3entry* id3, { global_settings.resume_index = -1; #ifdef HAVE_LCD_CHARCELLS - splash(HZ, true, str(LANG_END_PLAYLIST_PLAYER)); + gui_syncsplash(HZ, true, str(LANG_END_PLAYLIST_PLAYER)); #else status_draw(true); - splash(HZ, true, str(LANG_END_PLAYLIST_RECORDER)); + gui_syncsplash(HZ, true, str(LANG_END_PLAYLIST_RECORDER)); #endif return true; } diff --git a/apps/wps.c b/apps/wps.c index 31fcd2cb6d..95048bb8d0 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -80,7 +80,7 @@ static bool setvol(void) wps_refresh(id3, nid3, 0, WPS_REFRESH_NON_STATIC); settings_save(); #ifdef HAVE_LCD_CHARCELLS - splash(0, false, "Vol: %d %% ", + gui_syncsplash(0, false, "Vol: %d %% ", sound_val2phys(SOUND_VOLUME, global_settings.volume)); return true; #endif @@ -315,7 +315,7 @@ static void display_keylock_text(bool locked) else s = str(LANG_KEYLOCK_OFF_RECORDER); #endif - splash(HZ, true, s); + gui_syncsplash(HZ, true, s); } static void waitfor_nokey(void) -- cgit v1.2.3