diff options
author | Kevin Ferrare <kevin@rockbox.org> | 2005-11-06 17:30:53 +0000 |
---|---|---|
committer | Kevin Ferrare <kevin@rockbox.org> | 2005-11-06 17:30:53 +0000 |
commit | 3aa842c9a37928d718e8ea088c84901067d0889c (patch) | |
tree | 3085a8a5f47af6980c97beb8f22ea3a16e0031cc | |
parent | e7461b36092611cca29697f7aca59f2247923d90 (diff) |
some multi-screen work in playlist.c, properly formated splash.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7766 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/icon.h | 1 | ||||
-rw-r--r-- | apps/gui/splash.h | 5 | ||||
-rw-r--r-- | apps/playlist.c | 61 |
3 files changed, 36 insertions, 31 deletions
diff --git a/apps/gui/icon.h b/apps/gui/icon.h index 3bafdd9084..1208820558 100644 --- a/apps/gui/icon.h +++ b/apps/gui/icon.h @@ -19,7 +19,6 @@ #ifndef _GUI_ICON_H_ #define _GUI_ICON_H_ -#include "lcd.h" #include "screen_access.h" /* Defines a type for the icons since it's not the same thing on * char-based displays and bitmap displays */ diff --git a/apps/gui/splash.h b/apps/gui/splash.h index ca4cf268dd..b1aece9dde 100644 --- a/apps/gui/splash.h +++ b/apps/gui/splash.h @@ -17,6 +17,9 @@ * ****************************************************************************/ +#ifndef _GUI_SPLASH_H_ +#define _GUI_SPLASH_H_ +#include "screen_access.h" /* * Puts a splash message on the given screen for a given period * - screen : the screen to put the splash on @@ -37,3 +40,5 @@ extern void gui_splash(struct screen * screen, int ticks, */ extern void gui_syncsplash(int ticks, bool center, const char *fmt, ...); + +#endif /* _GUI_ICON_H_ */ diff --git a/apps/playlist.c b/apps/playlist.c index 9ab1ad9f4a..8bf1fd2116 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -93,6 +93,7 @@ #include "lang.h" #include "talk.h" +#include "splash.h" #define PLAYLIST_CONTROL_FILE ROCKBOX_DIR "/.playlist_control" #define PLAYLIST_CONTROL_FILE_VERSION 2 @@ -245,7 +246,7 @@ static void new_playlist(struct playlist_info* playlist, const char *dir, PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) fsync(playlist->control_fd); else - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); } } @@ -260,7 +261,7 @@ static void create_control(struct playlist_info* playlist) { if (check_rockboxdir()) { - splash(HZ*2, true, "%s (%d)", + gui_syncsplash(HZ*2, true, "%s (%d)", str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), playlist->control_fd); } @@ -294,7 +295,7 @@ static int check_control(struct playlist_info* playlist) PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) fsync(playlist->control_fd); else - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); playlist->filename[playlist->dirlen-1] = c; } @@ -353,7 +354,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist, lcd_setmargins(0, 0); #endif - splash(0, true, str(LANG_PLAYLIST_LOAD)); + gui_syncsplash(0, true, str(LANG_PLAYLIST_LOAD)); if (!buffer) { @@ -544,7 +545,7 @@ static int add_track_to_playlist(struct playlist_info* playlist, if (result < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); return result; } } @@ -578,7 +579,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist, if (ft_load(tc, dirname) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); global_settings.dirfilter = dirfilter; return -1; } @@ -739,7 +740,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist, if (result < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); return result; } } @@ -1086,9 +1087,9 @@ static int get_filename(struct playlist_info* playlist, int seek, if (max < 0) { if (control_file) - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); else - splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); return max; } @@ -1155,7 +1156,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion) if (ft_load(tc, (dir[0]=='\0')?"/":dir) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); exit = true; result = -1; break; @@ -1240,7 +1241,7 @@ static int check_subdir_for_music(char *dir, char *subdir) if (ft_load(tc, dir) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); return -2; } @@ -1293,7 +1294,7 @@ static int check_subdir_for_music(char *dir, char *subdir) /* we now need to reload our current directory */ if(ft_load(tc, dir) < 0) - splash(HZ*2, true, + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); } @@ -1378,7 +1379,7 @@ static void display_playlist_count(int count, const char *fmt) lcd_setmargins(0, 0); #endif - splash(0, true, fmt, count, + gui_syncsplash(0, true, fmt, count, #if CONFIG_KEYPAD == PLAYER_PAD str(LANG_STOP_ABORT) #else @@ -1392,7 +1393,7 @@ static void display_playlist_count(int count, const char *fmt) */ static void display_buffer_full(void) { - splash(HZ*2, true, "%s %s", + gui_syncsplash(HZ*2, true, "%s %s", str(LANG_PLAYINDICES_PLAYLIST), str(LANG_PLAYINDICES_BUFFER)); } @@ -1439,7 +1440,7 @@ static int flush_pending_control(struct playlist_info* playlist) if (result < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); return result; } } @@ -1540,7 +1541,7 @@ int playlist_resume(void) playlist->control_fd = open(playlist->control_filename, O_RDWR); if (playlist->control_fd < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } playlist->control_created = true; @@ -1548,7 +1549,7 @@ int playlist_resume(void) control_file_size = filesize(playlist->control_fd); if (control_file_size <= 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -1557,7 +1558,7 @@ int playlist_resume(void) PLAYLIST_COMMAND_SIZE<buflen?PLAYLIST_COMMAND_SIZE:buflen); if(nread <= 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -1833,7 +1834,7 @@ int playlist_resume(void) if (result < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID)); return result; } @@ -1842,7 +1843,7 @@ int playlist_resume(void) if ((total_read + count) >= control_file_size) { /* no newline at end of control file */ - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_INVALID)); return -1; } @@ -1929,7 +1930,7 @@ int playlist_shuffle(int random_seed, int start_index) start_current = true; } - splash(0, true, str(LANG_PLAYLIST_SHUFFLE)); + gui_syncsplash(0, true, str(LANG_PLAYLIST_SHUFFLE)); randomise_playlist(playlist, random_seed, start_current, true); @@ -2138,7 +2139,7 @@ int playlist_next(int steps) if (result < 0) { - splash(HZ*2, true, + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); return result; } @@ -2361,7 +2362,7 @@ int playlist_insert_track(struct playlist_info* playlist, if (check_control(playlist) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -2396,7 +2397,7 @@ int playlist_insert_directory(struct playlist_info* playlist, if (check_control(playlist) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -2443,14 +2444,14 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename, if (check_control(playlist) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } fd = open(filename, O_RDONLY); if (fd < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); return -1; } @@ -2549,7 +2550,7 @@ int playlist_delete(struct playlist_info* playlist, int index) if (check_control(playlist) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -2583,7 +2584,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index) if (check_control(playlist) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -2837,7 +2838,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) fd = open(tmp_buf, O_CREAT|O_WRONLY|O_TRUNC); if (fd < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_ACCESS_ERROR)); return -1; } @@ -2870,7 +2871,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) if (fdprintf(fd, "%s\n", tmp_buf) < 0) { - splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); + gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); result = -1; break; } |