Index: apps/screens.c =================================================================== --- apps/screens.c (revision 15283) +++ apps/screens.c (working copy) @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2002 Björn Stenberg + * Copyright (C) 2002 Bj�rn Stenberg * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -791,31 +791,9 @@ #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) -const int dayname[] = { - LANG_WEEKDAY_SUNDAY, - LANG_WEEKDAY_MONDAY, - LANG_WEEKDAY_TUESDAY, - LANG_WEEKDAY_WEDNESDAY, - LANG_WEEKDAY_THURSDAY, - LANG_WEEKDAY_FRIDAY, - LANG_WEEKDAY_SATURDAY -}; +extern const int dayname[]; +extern const int monthname[]; -const int monthname[] = { - LANG_MONTH_JANUARY, - LANG_MONTH_FEBRUARY, - LANG_MONTH_MARCH, - LANG_MONTH_APRIL, - LANG_MONTH_MAY, - LANG_MONTH_JUNE, - LANG_MONTH_JULY, - LANG_MONTH_AUGUST, - LANG_MONTH_SEPTEMBER, - LANG_MONTH_OCTOBER, - LANG_MONTH_NOVEMBER, - LANG_MONTH_DECEMBER -}; - /* little helper function for voice output */ static void say_time(int cursorpos, const struct tm *tm) { Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 15283) +++ apps/lang/english.lang (working copy) @@ -6880,7 +6880,7 @@ player: "Buf: %d.%03dMB" - *: "" + *: "Buffer size" @@ -6912,7 +6912,7 @@ *: "Disk:" - *: "" + *: "Disk size" Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (revision 15283) +++ apps/gui/list.c (working copy) @@ -1283,9 +1283,8 @@ while(1) { gui_syncstatusbar_draw(&statusbars, true); - if (list_do_action(CONTEXT_STD, info->timeout, - &lists, &action, LIST_WRAP_UNLESS_HELD)) - continue; + list_do_action(CONTEXT_STD, info->timeout, + &lists, &action, LIST_WRAP_UNLESS_HELD); if (info->action_callback) { action = info->action_callback(action, &lists); Index: apps/menus/main_menu.c =================================================================== --- apps/menus/main_menu.c (revision 15283) +++ apps/menus/main_menu.c (working copy) @@ -49,7 +49,6 @@ #include "time.h" - static struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG}; /***********************************/ @@ -129,9 +128,50 @@ unsigned long free2; #endif }; +enum InfoScreenOrder { + Order_SVN_revision = 0, + Order_GAP1, +#if CONFIG_RTC + Order_Time, + Order_Date, + Order_GAP2, +#endif + Order_Buffer, + Order_Batt, + Order_Disk1, /* capacity or internal capacity/free on hotswap */ + Order_Disk2,/* free space or external capacity/free on hotswap */ + Order_Count +}; +#if CONFIG_RTC +const int dayname[] = { + LANG_WEEKDAY_SUNDAY, + LANG_WEEKDAY_MONDAY, + LANG_WEEKDAY_TUESDAY, + LANG_WEEKDAY_WEDNESDAY, + LANG_WEEKDAY_THURSDAY, + LANG_WEEKDAY_FRIDAY, + LANG_WEEKDAY_SATURDAY +}; + +const int monthname[] = { + LANG_MONTH_JANUARY, + LANG_MONTH_FEBRUARY, + LANG_MONTH_MARCH, + LANG_MONTH_APRIL, + LANG_MONTH_MAY, + LANG_MONTH_JUNE, + LANG_MONTH_JULY, + LANG_MONTH_AUGUST, + LANG_MONTH_SEPTEMBER, + LANG_MONTH_OCTOBER, + LANG_MONTH_NOVEMBER, + LANG_MONTH_DECEMBER +}; +#endif static char* info_getname(int selected_item, void * data, char *buffer) { struct info_data *info = (struct info_data*)data; + struct tm *tm; const unsigned char *kbyte_units[] = { ID2P(LANG_KILOBYTE), ID2P(LANG_MEGABYTE), @@ -154,13 +194,34 @@ } switch (selected_item) { - case 0: + case Order_SVN_revision: snprintf(buffer, MAX_PATH, "%s: %s", str(LANG_VERSION), appsversion); break; - case 1: + case Order_GAP1: +#if CONFIG_RTC + case Order_GAP2: +#endif return ""; - case 2: /* buffer */ +#if CONFIG_RTC + case Order_Time: + tm = get_time(); + snprintf(buffer, MAX_PATH, "%02d:%02d:%02d %s", + global_settings.timeformat == 0 + ?tm->tm_hour:tm->tm_hour-12, + tm->tm_min, tm->tm_sec, + global_settings.timeformat == 0 + ?"":tm->tm_hour>11?"P":"A"); + break; + case Order_Date: + tm = get_time(); + snprintf(buffer, MAX_PATH, "%s %d %s %d", str(dayname[tm->tm_wday]), + tm->tm_year+1900, + str(monthname[tm->tm_mon]), + tm->tm_mday); + break; +#endif + case Order_Buffer: /* buffer */ { long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */ int integer = buflen / 1000; @@ -170,7 +231,7 @@ integer, decimal); } break; - case 3: /* battery */ + case Order_Batt: /* battery */ #if CONFIG_CHARGING == CHARGING_CONTROL if (charge_state == CHARGING) snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE)); @@ -186,7 +247,7 @@ else strcpy(buffer, "(n/a)"); break; - case 4: /* disc usage 1 */ + case Order_Disk1: /* disc usage 1 */ #ifdef HAVE_MULTIVOLUME output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true); output_dyn_value(s2, sizeof s2, info->size, kbyte_units, true); @@ -197,7 +258,7 @@ snprintf(buffer, MAX_PATH, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1); #endif break; - case 5: /* disc usage 2 */ + case Order_Disk2: /* disc usage 2 */ #ifdef HAVE_MULTIVOLUME if (info->size2) { @@ -223,23 +284,38 @@ ID2P(LANG_KILOBYTE), ID2P(LANG_MEGABYTE), ID2P(LANG_GIGABYTE) - }; + }; switch (selected_item) { - case 0:/* version, not voiced, so say the time instead */ + case Order_SVN_revision: /* version */ + talk_id(LANG_VERSION, false); + talk_spell(appsversion, true); + break; #if CONFIG_RTC - talk_date_time(get_time(), false); -#endif + case Order_Time: + talk_id(LANG_CURRENT_TIME, false); + talk_time(get_time(), true); break; - case 1: /* nothing */ + case Order_Date: + talk_date(get_time(), true); break; - case 2: /* buffer, not spoken */ - break; - case 3: /* battery */ +#endif + case Order_Buffer: /* buffer, not spoken */ + { + talk_id(LANG_BUFFER_STAT, false); + long buflen = (audiobufend - audiobuf) / 1024L; + output_dyn_value(NULL, 0, buflen, kbyte_units, true); + break; + } + case Order_Batt: /* battery */ if (battery_level() >= 0) { talk_id(LANG_BATTERY_TIME, false); talk_value(battery_level(), UNIT_PERCENT, true); + if(battery_time () / 60 > 0) + talk_value(battery_time () / 60, UNIT_INT, true); + if(battery_time () % 60 > 0) + talk_value(battery_time () % 60, UNIT_INT, true); #if CONFIG_CHARGING >= CHARGING_MONITOR if (charge_state == CHARGING) talk_id(LANG_BATTERY_CHARGE, true); @@ -252,20 +328,27 @@ #endif } break; - case 4: /* disk 1 */ + case Order_Disk1: /* disk 1 */ +#ifdef HAVE_MULTIVOLUME talk_id(LANG_DISK_FREE_INFO, false); -#ifdef HAVE_MULTIVOLUME talk_id(LANG_DISK_NAME_INTERNAL, true); + output_dyn_value(NULL, 0, info->free, kbyte_units, true); +#else + talk_id(LANG_DISK_SIZE_INFO, false); + output_dyn_value(NULL, 0, info->size, kbyte_units, true); #endif - output_dyn_value(NULL, 0, info->free, kbyte_units, true); break; - case 5: /* disk 2 */ + case Order_Disk2: /* disk 2 */ #ifdef HAVE_MULTIVOLUME if (info->size2) { + talk_id(LANG_DISK_FREE_INFO, false); talk_id(LANG_DISK_NAME_MMC, false); output_dyn_value(NULL, 0, info->free2, kbyte_units, true); } +#else + talk_id(LANG_DISK_FREE_INFO, false); + output_dyn_value(NULL, 0, info->free, kbyte_units, true); #endif break; } @@ -274,7 +357,8 @@ static int info_action_callback(int action, struct gui_synclist *lists) { - (void)lists; + if (action == ACTION_STD_CANCEL) + return action; if ((action == ACTION_STD_OK) #ifdef HAVE_MULTIVOLUME || action == SYS_HOTSWAP_INSERTED @@ -294,13 +378,33 @@ #endif return ACTION_REDRAW; } + else if (lists->gui_list[SCREEN_MAIN].show_selection_marker == true) + { + if (lists->gui_list[SCREEN_MAIN].selected_item == Order_GAP1 +#if CONFIG_RTC + || lists->gui_list[SCREEN_MAIN].selected_item == Order_GAP2 +#endif + ) + { + if (action == ACTION_STD_PREV) + { + gui_synclist_select_item(lists, lists->gui_list[SCREEN_MAIN].selected_item-1); + return ACTION_REDRAW; + } + else if (action == ACTION_STD_NEXT) + { + gui_synclist_select_item(lists, lists->gui_list[SCREEN_MAIN].selected_item+1); + return ACTION_REDRAW; + } + } + } return action; } static bool show_info(void) { - struct info_data data = {.new_data = true}; + struct info_data data = {.new_data = true }; struct simplelist_info info; - simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), 6, (void*)&data); + simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), Order_Count, (void*)&data); info.hide_selection = !global_settings.talk_menu; info.get_name = info_getname; if(global_settings.talk_menu) Index: apps/talk.c =================================================================== --- apps/talk.c (revision 15283) +++ apps/talk.c (working copy) @@ -848,66 +848,61 @@ } #if CONFIG_RTC -void talk_date_time(struct tm *tm, bool speak_current_time_string) +void talk_date(struct tm *tm, bool enqueue) { - if(global_settings.talk_menu) + talk_id(LANG_MONTH_JANUARY + tm->tm_mon, enqueue); + talk_number(tm->tm_mday, true); + talk_number(1900 + tm->tm_year, true); +} + +void talk_time(struct tm *tm, bool enqueue) +{ + if (global_settings.timeformat == 1) { - if(speak_current_time_string) - talk_id(VOICE_CURRENT_TIME, true); - if (global_settings.timeformat == 1) + /* Voice the hour */ + long am_pm_id = VOICE_AM; + int hour = tm->tm_hour; + if (hour >= 12) { - long am_pm_id = VOICE_AM; - int hour = tm->tm_hour; + am_pm_id = VOICE_PM; + hour -= 12; + } + if (hour == 0) + hour = 12; + talk_number(hour, enqueue); - if (hour >= 12) - { - am_pm_id = VOICE_PM; - hour -= 12; - } - if (hour == 0) - hour = 12; - - talk_number(hour, true); - - /* Voice the minutes */ - if (tm->tm_min == 0) - { - /* Say o'clock if the minute is 0. */ - talk_id(VOICE_OCLOCK, true); - } - else - { - /* Pronounce the leading 0 */ - if(tm->tm_min < 10) - { - talk_id(VOICE_OH, true); - } - talk_number(tm->tm_min, true); - } - talk_id(am_pm_id, true); + /* Voice the minutes */ + if (tm->tm_min == 0) + { + /* Say o'clock if the minute is 0. */ + talk_id(VOICE_OCLOCK, true); } else { - /* Voice the time in 24 hour format */ - talk_number(tm->tm_hour, true); - if (tm->tm_min == 0) - { - talk_id(VOICE_HUNDRED, true); - talk_id(VOICE_HOUR, true); - } - else - { - /* Pronounce the leading 0 */ - if(tm->tm_min < 10) - { - talk_id(VOICE_OH, true); - } - talk_number(tm->tm_min, true); - } + /* Pronounce the leading 0 */ + if(tm->tm_min < 10) + talk_id(VOICE_OH, true); + talk_number(tm->tm_min, true); } - talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true); - talk_number(tm->tm_mday, true); - talk_number(1900 + tm->tm_year, true); + talk_id(am_pm_id, true); } + else + { + /* Voice the time in 24 hour format */ + talk_number(tm->tm_hour, enqueue); + if (tm->tm_min == 0) + { + talk_id(VOICE_HUNDRED, true); + talk_id(VOICE_HOUR, true); + } + else + { + /* Pronounce the leading 0 */ + if(tm->tm_min < 10) + talk_id(VOICE_OH, true); + talk_number(tm->tm_min, true); + } + } } + #endif Index: apps/talk.h =================================================================== --- apps/talk.h (revision 15283) +++ apps/talk.h (working copy) @@ -80,9 +80,11 @@ #if CONFIG_RTC /* this is in talk.c which isnt compiled for hwcodec simulator */ #if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC -void talk_date_time(struct tm *time, bool speak_current_time_string); +void talk_time(struct tm *tm, bool enqueue); +void talk_date(struct tm *tm, bool enqueue); #else -#define talk_date_time(t, s) +#define talk_date(t, e) +#define talk_time(t, e) #endif #endif /* CONFIG_RTC */ Index: uisimulator/common/io.c =================================================================== --- uisimulator/common/io.c (revision 15283) +++ uisimulator/common/io.c (working copy) @@ -139,7 +139,7 @@ void dircache_rename(const char *oldpath, const char *newpath); #endif -#define SIMULATOR_ARCHOS_ROOT "archos" +#define SIMULATOR_ARCHOS_ROOT "M:" static int num_openfiles = 0;