summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2007-10-24 15:34:36 +0000
committerSteve Bavin <pondlife@pondlife.me>2007-10-24 15:34:36 +0000
commitfda41b892eba8a72cdf221ff32608656a1c036cc (patch)
tree201072ded9067f4315e26ba7eefd4947610c4a1a /apps
parent1e45eecb230ceb46d03f3c480450e13913ad9a52 (diff)
Try and save some bytes, seeing as we already assumed LANG_ constants for month and weekday names are contiguous.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15289 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/gwps-common.c4
-rw-r--r--apps/menus/main_menu.c69
-rw-r--r--apps/screens.c9
3 files changed, 13 insertions, 69 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index a2f1aa660b..fec13d564f 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1160,12 +1160,12 @@ static char *get_token_value(struct gui_wps *gwps,
case WPS_TOKEN_RTC_WEEKDAY_NAME:
/* a: abbreviated weekday name (Sun..Sat) */
- snprintf(buf, buf_size, "%s",str(dayname[tm->tm_wday]));
+ snprintf(buf, buf_size, "%s",str(LANG_WEEKDAY_SUNDAY + tm->tm_wday));
return buf;
case WPS_TOKEN_RTC_MONTH_NAME:
/* b: abbreviated month name (Jan..Dec) */
- snprintf(buf, buf_size, "%s",str(monthname[tm->tm_mon]));
+ snprintf(buf, buf_size, "%s",str(LANG_MONTH_JANUARY + tm->tm_mon));
return buf;
case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON:
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index ea223d9702..5231181296 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -131,46 +131,17 @@ struct info_data
enum infoscreenorder
{
INFO_VERSION = 0,
- INFO_GAP1,
#if CONFIG_RTC
INFO_TIME,
INFO_DATE,
- INFO_GAP2,
#endif
INFO_BUFFER,
INFO_BATTERY,
INFO_DISK1, /* capacity or internal capacity/free on hotswap */
INFO_DISK2, /* free space or external capacity/free on hotswap */
INFO_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;
@@ -204,11 +175,6 @@ static char* info_getname(int selected_item, void *data, char *buffer)
snprintf(buffer, MAX_PATH, "%s: %s",
str(LANG_VERSION), appsversion);
break;
- case INFO_GAP1:
-#if CONFIG_RTC
- case INFO_GAP2:
-#endif
- return "";
#if CONFIG_RTC
case INFO_TIME:
tm = get_time();
@@ -220,11 +186,10 @@ static char* info_getname(int selected_item, void *data, char *buffer)
break;
case INFO_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);
+ snprintf(buffer, MAX_PATH, "%s %d %d",
+ str(LANG_MONTH_JANUARY + tm->tm_mon),
+ tm->tm_mday,
+ tm->tm_year+1900);
break;
#endif
case INFO_BUFFER: /* buffer */
@@ -379,30 +344,12 @@ static int info_action_callback(int action, struct gui_synclist *lists)
#ifdef HAVE_MULTIVOLUME
if (fat_ismounted(1))
fat_recalc_free(1);
-#endif
+#endif
+#else
+ (void) lists;
#endif
return ACTION_REDRAW;
}
- else if (lists->gui_list[SCREEN_MAIN].show_selection_marker == true)
- {
- if (lists->gui_list[SCREEN_MAIN].selected_item == INFO_GAP1
-#if CONFIG_RTC
- || lists->gui_list[SCREEN_MAIN].selected_item == INFO_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)
diff --git a/apps/screens.c b/apps/screens.c
index f890f62eab..703ec7badb 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -791,9 +791,6 @@ void charging_splash(void)
#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
-extern const int dayname[];
-extern const int monthname[];
-
/* little helper function for voice output */
static void say_time(int cursorpos, const struct tm *tm)
{
@@ -870,7 +867,7 @@ bool set_time_screen(const char* title, struct tm *tm)
ptr[1] = buffer + 3; /* minutes */
ptr[2] = buffer + 6; /* seconds */
ptr[3] = buffer + 9; /* year */
- ptr[4] = str(monthname[tm->tm_mon]); /* monthname */
+ ptr[4] = str(LANG_MONTH_JANUARY + tm->tm_mon); /* monthname */
ptr[5] = buffer + 14; /* day of month */
/* calculate the number of days in febuary */
@@ -949,7 +946,7 @@ bool set_time_screen(const char* title, struct tm *tm)
cursor[2][INDEX_Y] = prev_line_height + statusbar_height;
/* weekday */
- screens[s].getstringsize(str(dayname[tm->tm_wday]), &weekday_width, NULL);
+ screens[s].getstringsize(str(LANG_WEEKDAY_SUNDAY + tm->tm_wday), &weekday_width, NULL);
screens[s].getstringsize(" ", &separator_width, NULL);
/* year */
@@ -974,7 +971,7 @@ bool set_time_screen(const char* title, struct tm *tm)
screens[s].puts_scroll(0, 0, title);
/* these are not selectable, so we draw them outside the loop */
- screens[s].putsxy(0, cursor[3][INDEX_Y], str(dayname[tm->tm_wday])); /* name of the week day */
+ screens[s].putsxy(0, cursor[3][INDEX_Y], str(LANG_WEEKDAY_SUNDAY + tm->tm_wday)); /* name of the week day */
screens[s].putsxy(cursor[1][INDEX_X] - separator_width,
cursor[0][INDEX_Y], SEPARATOR);
screens[s].putsxy(cursor[2][INDEX_X] - separator_width,