? wps ? build ? wps-sb-tag.patch ? tools/iaudio ? tools/rdf2binary ? tools/mkboot ? tools/ipod_fw Index: apps/main.c =================================================================== RCS file: /cvsroot/rockbox/apps/main.c,v retrieving revision 1.149 diff -u -r1.149 main.c --- apps/main.c 19 Nov 2005 09:47:31 -0000 1.149 +++ apps/main.c 20 Nov 2005 17:35:40 -0000 @@ -151,7 +151,6 @@ settings_reset(); settings_calc_config_sector(); settings_load(SETTINGS_ALL); - gui_sync_data_wps_init(); gui_sync_wps_init(); settings_apply(); init_dircache(); @@ -318,7 +317,6 @@ settings_calc_config_sector(); settings_load(SETTINGS_ALL); init_dircache(); - gui_sync_data_wps_init(); gui_sync_wps_init(); settings_apply(); Index: apps/gui/gwps-common.c =================================================================== RCS file: /cvsroot/rockbox/apps/gui/gwps-common.c,v retrieving revision 1.7 diff -u -r1.7 gwps-common.c --- apps/gui/gwps-common.c 19 Nov 2005 20:35:40 -0000 1.7 +++ apps/gui/gwps-common.c 20 Nov 2005 17:35:46 -0000 @@ -17,7 +17,6 @@ * ****************************************************************************/ #include "gwps-common.h" -#include "gwps.h" #include "font.h" #include #include @@ -37,7 +36,6 @@ #include "lang.h" #include "misc.h" -#include "statusbar.h" #include "splash.h" #include "scrollbar.h" #ifdef HAVE_LCD_BITMAP @@ -57,6 +55,23 @@ /* 3% of 30min file == 54s step size */ #define MIN_FF_REWIND_STEP 500 +/* draws the statusbar on the given wps-screen */ +static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force) +{ + bool draw = global_settings.statusbar; + if(wps->data->wps_sb_tag + && gui_wps->data->show_sb_on_wps) + draw = true; + else if(wps->data->wps_sb_tag) + draw = false; + if(draw) + { + wps->statusbar->on_wps = true; + gui_statusbar_draw(wps->statusbar, force); + wps->statusbar->on_wps = false; + } +} + /* Format time into buf. * * buf - buffer to format to. @@ -944,6 +959,10 @@ subline = 0; data->format_lines[line][subline] = buf; + bool wps_tag_found = false; + data->wps_sb_tag = false; + data->show_sb_on_wps = false; + while ((*buf) && (line < WPS_MAX_LINES)) { c = *buf; @@ -955,6 +974,14 @@ * don't skip %x lines (pre-load bitmaps) */ case '%': + if(*(buf+1) == 'w' && (*(buf+2) == 'd' || *(buf+2) == 'e') + && !wps_tag_found) + { + data->wps_sb_tag = true; + if( *(buf+1) == 'w' && *(buf+2) == 'e' ) + data->show_sb_on_wps = true; + wps_tag_found = true; + } if (*(buf+1) != 'x') buf++; break; @@ -1177,7 +1204,12 @@ } #ifdef HAVE_LCD_BITMAP int h = font_get(FONT_UI)->height; - int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; + int offset = 0; + if(data->wps_sb_tag && data->show_sb_on_wps) + offset = STATUSBAR_HEIGHT; + else if ( global_settings.statusbar && !data->wps_sb_tag) + offset = STATUSBAR_HEIGHT; + /* to find out wether the peak meter is enabled we assume it wasn't until we find a line that contains the peak meter. We can't use peak_meter_enabled itself @@ -1774,24 +1806,26 @@ } #endif -/* set volume - return true if screen restore is needed - return false otherwise -*/ -bool setvol(void) +/* set volume */ +void setvol(void) { if (global_settings.volume < sound_min(SOUND_VOLUME)) global_settings.volume = sound_min(SOUND_VOLUME); if (global_settings.volume > sound_max(SOUND_VOLUME)) global_settings.volume = sound_max(SOUND_VOLUME); sound_set_volume(global_settings.volume); - gui_syncstatusbar_draw(&statusbars, false); - int i; - FOR_NB_SCREENS(i) - gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC); settings_save(); +} +/* return true if screen restore is needed + return false otherwise +*/ +bool update_onvol_change(struct gui_wps * gwps) +{ + gui_wps_statusbar_draw(gwps, false); + gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); + #ifdef HAVE_LCD_CHARCELLS - gui_syncsplash(0, false, "Vol: %d %% ", + gui_splash(gwps->display,0, false, "Vol: %d %% ", sound_val2phys(SOUND_VOLUME, global_settings.volume)); return true; #endif @@ -1837,13 +1871,13 @@ max_step = (wps_state.id3->length - (wps_state.id3->elapsed + ff_rewind_count)) * - FF_REWIND_MAX_PERCENT / 100; + FF_REWIND_MAX_PERCENT / 100; } else { /* rewinding, calc max step relative to start */ max_step = (wps_state.id3->elapsed + ff_rewind_count) * - FF_REWIND_MAX_PERCENT / 100; + FF_REWIND_MAX_PERCENT / 100; } max_step = MAX(max_step, MIN_FF_REWIND_STEP); @@ -2003,10 +2037,10 @@ } yield(); FOR_NB_SCREENS(i) - gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL); - gui_syncstatusbar_draw(&statusbars, true); - FOR_NB_SCREENS(i) { + gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL); + gui_wps_statusbar_draw(&gui_wps[i], true); + #ifdef HAVE_LCD_BITMAP wps_display_images(&gui_wps[i]); gui_wps[i].display->update(); @@ -2039,9 +2073,9 @@ if (gwps->state->id3) gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); - gui_syncstatusbar_draw(&statusbars, false); - - return retcode; + gui_wps_statusbar_draw(gwps, false); + + return retcode; } #ifdef WPS_KEYLOCK Index: apps/gui/gwps-common.h =================================================================== RCS file: /cvsroot/rockbox/apps/gui/gwps-common.h,v retrieving revision 1.2 diff -u -r1.2 gwps-common.h --- apps/gui/gwps-common.h 18 Nov 2005 09:03:25 -0000 1.2 +++ apps/gui/gwps-common.h 20 Nov 2005 17:35:46 -0000 @@ -30,7 +30,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, unsigned char refresh_mode); bool gui_wps_display(void); -bool setvol(void); +void setvol(void); +bool update_onvol_change(struct gui_wps * gwps); bool update(struct gui_wps *gwps); bool ffwd_rew(int button); #ifdef WPS_KEYLOCK Index: apps/gui/gwps.c =================================================================== RCS file: /cvsroot/rockbox/apps/gui/gwps.c,v retrieving revision 1.5 diff -u -r1.5 gwps.c --- apps/gui/gwps.c 18 Nov 2005 15:33:05 -0000 1.5 +++ apps/gui/gwps.c 20 Nov 2005 17:35:47 -0000 @@ -53,7 +53,6 @@ #include "abrepeat.h" #include "playback.h" -#include "statusbar.h" #include "splash.h" #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" @@ -68,6 +67,17 @@ /* change the path to the current played track */ static void wps_state_update_ctp(const char *path); +static void gui_wps_set_margine(struct gui_wps *gwps) +{ + int offset = 0; + struct wps_data *data = gwps->data; + if(data->wps_sb_tag && data->show_sb_on_wps) + offset = STATUSBAR_HEIGHT; + else if ( global_settings.statusbar && !data->wps_sb_tag) + offset = STATUSBAR_HEIGHT; + gwps->display->setmargins(0, offset); +} + long gui_wps_show(void) { long button = 0, lastbutton = 0; @@ -88,8 +98,7 @@ #else FOR_NB_SCREENS(i) { - gui_wps[i].display->setmargins(0, global_settings.statusbar? - STATUSBAR_HEIGHT:0); + gui_wps_set_margine(&gui_wps[i]); } #endif @@ -156,12 +165,12 @@ if (TIME_AFTER(current_tick, next_refresh)) { FOR_NB_SCREENS(i) - { - if(gui_wps[i].data->peak_meter_enabled) - gui_wps_refresh(&gui_wps[i], 0, - WPS_REFRESH_PEAK_METER); - next_refresh += HZ / PEAK_METER_FPS; - } + { + if(gui_wps[i].data->peak_meter_enabled) + gui_wps_refresh(&gui_wps[i], 0, + WPS_REFRESH_PEAK_METER); + next_refresh += HZ / PEAK_METER_FPS; + } } } @@ -215,6 +224,12 @@ case WPS_RC_CONTEXT: #endif onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS); +#ifdef HAVE_LCD_BITMAP + FOR_NB_SCREENS(i) + { + gui_wps_set_margine(&gui_wps[i]); + } +#endif restore = true; break; #endif @@ -289,11 +304,20 @@ case WPS_RC_INCVOL: case WPS_RC_INCVOL | BUTTON_REPEAT: #endif + { global_settings.volume++; - if (setvol()) { + bool res = false; + setvol(); + FOR_NB_SCREENS(i) + { + if(update_onvol_change(&gui_wps[i])) + res = true; + } + if (res) { restore = true; restoretimer = current_tick + HZ; } + } break; /* volume down */ @@ -303,11 +327,20 @@ case WPS_RC_DECVOL: case WPS_RC_DECVOL | BUTTON_REPEAT: #endif + { global_settings.volume--; - if (setvol()) { + setvol(); + bool res = false; + FOR_NB_SCREENS(i) + { + if(update_onvol_change(&gui_wps[i])) + res = true; + } + if (res) { restore = true; restoretimer = current_tick + HZ; } + } break; /* fast forward / rewind */ @@ -450,9 +483,7 @@ #ifdef HAVE_LCD_BITMAP FOR_NB_SCREENS(i) { - gui_wps[i].display->setmargins(0, - global_settings.statusbar? - STATUSBAR_HEIGHT:0); + gui_wps_set_margine(&gui_wps[i]); } #endif restore = true; @@ -581,13 +612,13 @@ if (update_track) { - bool upt = false; + bool update_failed = false; FOR_NB_SCREENS(i) { if(update(&gui_wps[i])) - upt = true; + update_failed = true; } - if (upt) + if (update_failed) { /* set dir browser to current playing song */ if (global_settings.browse_current && @@ -670,6 +701,8 @@ wps_data->img[i].display = false; wps_data->img[i].always_display = false; } + wps_data->wps_sb_tag = false; + wps_data->show_sb_on_wps = false; #else /* HAVE_LCD_CHARCELLS */ for(i = 0; i < 8; i++) wps_data->wps_progress_pat[i] = 0; @@ -861,6 +894,7 @@ { gui_wps->data = NULL; gui_wps->display = NULL; + gui_wps->statusbar = NULL; /* Currently no seperate wps_state needed/possible so use the only aviable ( "global" ) one */ gui_wps->state = &wps_state; @@ -877,14 +911,12 @@ { gui_wps->display = display; } -/* gui_wps end */ -void gui_sync_data_wps_init(void) +void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar) { - int i; - FOR_NB_SCREENS(i) - wps_data_init(&wps_datas[i]); + gui_wps->statusbar = statusbar; } +/* gui_wps end */ void gui_sync_wps_screen_init(void) { @@ -898,7 +930,9 @@ int i; FOR_NB_SCREENS(i) { + wps_data_init(&wps_datas[i]); gui_wps_init(&gui_wps[i]); gui_wps_set_data(&gui_wps[i], &wps_datas[i]); + gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); } } Index: apps/gui/gwps.h =================================================================== RCS file: /cvsroot/rockbox/apps/gui/gwps.h,v retrieving revision 1.3 diff -u -r1.3 gwps.h --- apps/gui/gwps.h 19 Nov 2005 03:19:12 -0000 1.3 +++ apps/gui/gwps.h 20 Nov 2005 17:35:48 -0000 @@ -20,6 +20,7 @@ #define _WPS_H #include "screen_access.h" +#include "statusbar.h" #include "id3.h" #include "playlist.h" @@ -319,6 +320,7 @@ struct screen * display; struct wps_data *data; struct wps_state *state; + struct gui_statusbar *statusbar; }; /* initial setup of a wps */ @@ -329,6 +331,9 @@ /* connects a wps with a screen */ void gui_wps_set_disp(struct gui_wps *gui_wps, struct screen *display); + +/* connects a wps with a statusbar*/ +void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar); /* gui_wps end */ long gui_wps_show(void); @@ -338,7 +343,6 @@ extern struct gui_wps gui_wps[NB_SCREENS]; void gui_sync_wps_init(void); -void gui_sync_data_wps_init(void); void gui_sync_wps_screen_init(void); #endif Index: apps/gui/statusbar.c =================================================================== RCS file: /cvsroot/rockbox/apps/gui/statusbar.c,v retrieving revision 1.10 diff -u -r1.10 statusbar.c --- apps/gui/statusbar.c 20 Nov 2005 01:02:14 -0000 1.10 +++ apps/gui/statusbar.c 20 Nov 2005 17:35:49 -0000 @@ -90,6 +90,7 @@ { bar->last_volume = -1; /* -1 means "first update ever" */ bar->battery_icon_switch_tick = 0; + bar->on_wps = false; #ifdef HAVE_CHARGING bar->battery_charge_step = 0; #endif @@ -105,7 +106,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) { #ifdef HAVE_LCD_BITMAP - if(!global_settings.statusbar) + if(!global_settings.statusbar && !bar->on_wps) return; #endif /* HAVE_LCD_BITMAP */ Index: apps/gui/statusbar.h =================================================================== RCS file: /cvsroot/rockbox/apps/gui/statusbar.h,v retrieving revision 1.8 diff -u -r1.8 statusbar.h --- apps/gui/statusbar.h 20 Nov 2005 01:02:14 -0000 1.8 +++ apps/gui/statusbar.h 20 Nov 2005 17:35:50 -0000 @@ -57,6 +57,7 @@ /* Volume icon stuffs */ long volume_icon_switch_tick; int last_volume; + bool on_wps; long battery_icon_switch_tick;