summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/lang/english.lang74
-rw-r--r--apps/screens.c280
2 files changed, 197 insertions, 157 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index c50a1269d4..3137ff7ed7 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -11,7 +11,7 @@
# If you re-order things or remove entries, you must bump the binary language
# file version number in both the 'binlang' tool and the language loader code.
#
-# The "voice' entry contains how we want the speech UI to pronounce this.
+# The "voice' entry contains how we want the speech UI to pronounce this.
#
id: LANG_SOUND_SETTINGS
desc: in the main menu
@@ -233,7 +233,7 @@ id: LANG_RESET_ASK_RECORDER
desc: confirm to reset settings
eng: "Are You Sure?"
voice: ""
-new:
+new:
id: LANG_RESET_DONE_SETTING
desc: visual confirmation after settings reset
@@ -470,20 +470,20 @@ voice: ""
new:
id: LANG_ID3_NO_TITLE
-desc: in wps when no title is avaible
-eng: "<No Title>"
+desc: DEPRECATED
+eng: ""
voice: ""
new:
id: LANG_ID3_ARTIST
-desc: in wps
+desc: in wps
eng: "[Artist]"
voice: ""
new:
id: LANG_ID3_NO_ARTIST
-desc: in wps when no artist is avaible
-eng: "<No Artist>"
+desc: DEPRECATED
+eng: ""
voice: ""
new:
@@ -494,8 +494,8 @@ voice: ""
new:
id: LANG_ID3_NO_ALBUM
-desc: in wps when no album is avaible
-eng: "<No Album>"
+desc: DEPRECATED
+eng: ""
voice: ""
new:
@@ -506,8 +506,8 @@ voice: ""
new:
id: LANG_ID3_NO_TRACKNUM
-desc: in wps if no track number is avaible
-eng: "<No Tracknum>"
+desc: DEPRECATED
+eng: ""
voice: ""
new:
@@ -539,7 +539,7 @@ id: LANG_ID3_PATH
desc: in wps
eng: "[Path]"
voice: ""
-new:
+new:
id: LANG_PITCH_UP
desc: in wps
@@ -593,7 +593,7 @@ id: LANG_END_PLAYLIST_RECORDER
desc: when playlist has finished
eng: "End Of Song List"
voice: ""
-new:
+new:
id: LANG_POWEROFF_IDLE
desc: in settings_menu
@@ -647,37 +647,37 @@ id: LANG_PM_MENU
desc: in the display menu
eng: "Peak Meter"
voice: "Peak Meter"
-new:
+new:
id: LANG_PM_RELEASE
desc: in the peak meter menu
eng: "Peak Release"
voice: "Peak Release"
-new:
+new:
id: LANG_PM_PEAK_HOLD
desc: in the peak meter menu
eng: "Peak Hold Time"
voice: "Peak Hold Time"
-new:
+new:
id: LANG_PM_CLIP_HOLD
desc: in the peak meter menu
eng: "Clip Hold Time"
voice: "Clip Hold Time"
-new:
+new:
id: LANG_PM_ETERNAL
desc: in the peak meter menu
eng: "Eternal"
voice: "Eternal"
-new:
+new:
id: LANG_PM_UNITS_PER_READ
desc: in the peak meter menu
eng: "Units Per Read"
voice: "Units Per Read"
-new:
+new:
id: LANG_BACKLIGHT_ON_WHEN_CHARGING
desc: in display_settings_menu
@@ -708,7 +708,7 @@ desc: confirm to reset settings
eng: "PLAY=Reset"
voice: ""
new:
-
+
id: LANG_RESET_CANCEL
desc: confirm to reset settings
eng: "OFF=Cancel"
@@ -1133,43 +1133,43 @@ id: LANG_FAILED
desc: Something failed. To be appended after above actions
eng: "Failed"
voice: ""
-new:
+new:
id: LANG_ALARM_MOD_ALARM_MENU
desc: The name of the additional entry in the main menu for the RTC alarm mod.
eng: "Wake-Up Alarm"
voice: "Wake-Up Alarm"
-new:
+new:
id: LANG_ALARM_MOD_TIME
desc: The current alarm time shown in the alarm menu for the RTC alarm mod.
eng: "Alarm Time: %02d:%02d"
voice: ""
-new:
+new:
id: LANG_ALARM_MOD_TIME_TO_GO
desc: The time until the alarm will go off shown in the alarm menu for the RTC alarm mod.
eng: "Waking Up In %d:%02d"
voice: ""
-new:
+new:
id: LANG_ALARM_MOD_SHUTDOWN
desc: The text that tells the user that the alarm time is ok and the device shuts off (for the RTC alarm mod).
eng: "Alarm Set"
voice: ""
-new:
+new:
id: LANG_ALARM_MOD_ERROR
desc: The text that tells that the time is incorrect (for the RTC alarm mod).
eng: "Alarm Time Is Too Soon!"
voice: ""
-new:
+new:
id: LANG_ALARM_MOD_KEYS
desc: Shown key functions in alarm menu (for the RTC alarm mod).
eng: "PLAY=Set OFF=Cancel"
voice: ""
-new:
+new:
id: LANG_CREATE_PLAYLIST
desc: Menu option for creating a playlist
@@ -1253,7 +1253,7 @@ id: LANG_SETTINGS_LOADED2
desc: Feedback shown when a .cfg file is loaded
eng: "Loaded"
voice: ""
-new:
+new:
id: LANG_FADE_ON_STOP
desc: options menu to set fade on stop or pause
@@ -1301,37 +1301,37 @@ id: LANG_SAVE_SETTINGS
desc: in system_settings_menu()
eng: "Write .cfg file"
voice: "Write configuration file"
-new:
+new:
id: LANG_SETTINGS_SAVED1
desc: Feedback shown when a .cfg file is saved
eng: "Settings"
voice: ""
-new:
+new:
id: LANG_SETTINGS_SAVED2
desc: Feedback shown when a .cfg file is saved
eng: "Saved"
voice: ""
-new:
+new:
id: LANG_VBRFIX_STOP_PLAY
desc: DEPRECATED
eng: ""
voice: ""
-new:
+new:
id: LANG_VBRFIX_NOT_VBR
desc: DEPRECATED
eng: ""
voice: ""
-new:
+new:
id: LANG_VBRFIX
desc: DEPRECATED
eng: ""
voice: ""
-new:
+new:
id: LANG_INVERT_CURSOR
desc: in settings_menu
@@ -1663,7 +1663,7 @@ id: LANG_CAR_ADAPTER_MODE
desc: Displayed for setting car adapter mode to on/off
eng: "Car Adapter Mode"
voice: "Car Adapter Mode"
-new:
+new:
id: LANG_LINE_IN
desc: in settings_menu
@@ -3234,8 +3234,8 @@ voice ""
new:
id: LANG_ID3_NO_GAIN
-desc: in browse_id3
-eng: "<No gain>"
+desc: DEPRECATED
+eng: ""
voice ""
new:
diff --git a/apps/screens.c b/apps/screens.c
index 2c7d5fe9b1..1cbda99d0f 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -46,11 +46,16 @@
#include "led.h"
#include "sound.h"
#include "wps-display.h"
+#if defined(HAVE_LCD_BITMAP)
+#include "widgets.h"
+#endif
#ifdef HAVE_MMC
#include "ata_mmc.h"
#endif
#ifdef HAVE_LCD_BITMAP
+#define SCROLLBAR_WIDTH 6
+
#define BMPHEIGHT_usb_logo 32
#define BMPWIDTH_usb_logo 100
static const unsigned char usb_logo[] = {
@@ -1269,156 +1274,186 @@ bool shutdown_screen(void)
}
#endif
-bool browse_id3(void)
+int draw_id3_item(int line, int top, int header, const char* body)
{
- struct mp3entry* id3 = audio_current_track();
- int button;
- int menu_pos = 0;
+ if (line >= top)
+ {
+#if defined(HAVE_LCD_BITMAP)
+ const int rows = LCD_HEIGHT / font_get(FONT_UI)->height;
+#else
+ const int rows = 2;
+#endif
+ int y = line - top;
+
+ if (y < rows)
+ {
+ lcd_puts(0, y, str(header));
+ }
+
+ if (++y < rows)
+ {
+ lcd_puts_scroll(0, y,
+ body ? (const unsigned char*) body : str(LANG_ID3_NO_INFO));
+ }
+ }
+
+ return line + 2;
+}
+
#if CONFIG_HWCODEC == MASNONE
- int menu_max = 12;
+#define ID3_ITEMS 13
#else
- int menu_max = 10;
+#define ID3_ITEMS 11
#endif
+
+bool browse_id3(void)
+{
+ char buf[32];
+ const struct mp3entry* id3 = audio_current_track();
+#if defined(HAVE_LCD_BITMAP)
+ const int y_margin = lcd_getymargin();
+ const int line_height = font_get(FONT_UI)->height;
+ const int rows = (LCD_HEIGHT - y_margin) / line_height;
+ const bool show_scrollbar = global_settings.scrollbar
+ && (ID3_ITEMS * 2 > rows);
+#else
+ const int rows = 2;
+#endif
+ const int top_max = (ID3_ITEMS * 2) - (rows & ~1);
+ int top = 0;
+ int button;
bool exit = false;
- char scroll_text[MAX_PATH];
- if (!(audio_status() & AUDIO_STATUS_PLAY))
+ if (!id3 || (!(audio_status() & AUDIO_STATUS_PLAY)))
+ {
return false;
+ }
+
+#if defined(HAVE_LCD_BITMAP)
+ lcd_setmargins(show_scrollbar ? SCROLLBAR_WIDTH : 0, y_margin);
+#endif
while (!exit)
{
+ int line = 0;
+ int old_top = top;
+ char* body;
+
lcd_clear_display();
+ status_draw(true);
+ line = draw_id3_item(line, top, LANG_ID3_TITLE, id3->title);
+ line = draw_id3_item(line, top, LANG_ID3_ARTIST, id3->artist);
+ line = draw_id3_item(line, top, LANG_ID3_ALBUM, id3->album);
- switch (menu_pos)
+ if (id3->track_string)
{
- case 0:
- lcd_puts(0, 0, str(LANG_ID3_TITLE));
- lcd_puts_scroll(0, 1, id3->title ? id3->title :
- (char*)str(LANG_ID3_NO_TITLE));
- break;
-
- case 1:
- lcd_puts(0, 0, str(LANG_ID3_ARTIST));
- lcd_puts_scroll(0, 1,
- id3->artist ? id3->artist :
- (char*)str(LANG_ID3_NO_ARTIST));
- break;
-
- case 2:
- lcd_puts(0, 0, str(LANG_ID3_ALBUM));
- lcd_puts_scroll(0, 1, id3->album ? id3->album :
- (char*)str(LANG_ID3_NO_ALBUM));
- break;
-
- case 3:
- lcd_puts(0, 0, str(LANG_ID3_TRACKNUM));
-
- if (id3->track_string) {
- lcd_puts_scroll(0, 1, id3->track_string);
- }
- else if (id3->tracknum) {
- snprintf(scroll_text,sizeof(scroll_text), "%d",
- id3->tracknum);
- lcd_puts_scroll(0, 1, scroll_text);
- }
- else
- lcd_puts_scroll(0, 1, str(LANG_ID3_NO_TRACKNUM));
- break;
+ body = id3->track_string;
+ }
+ else if (id3->tracknum)
+ {
+ snprintf(buf, sizeof(buf), "%d", id3->tracknum);
+ body = buf;
+ }
+ else
+ {
+ body = NULL;
+ }
- case 4:
- lcd_puts(0, 0, str(LANG_ID3_GENRE));
+ line = draw_id3_item(line, top, LANG_ID3_TRACKNUM, body);
- if (id3->genre_string) {
- lcd_puts_scroll(0, 1, id3->genre_string);
- }
- else {
- lcd_puts_scroll(0, 1,
- id3_get_genre(id3) ?
- id3_get_genre(id3) :
- (char*)str(LANG_ID3_NO_INFO));
- }
- break;
+ body = id3->genre_string ? id3->genre_string : id3_get_genre(id3);
+ line = draw_id3_item(line, top, LANG_ID3_GENRE, body);
- case 5:
- lcd_puts(0, 0, str(LANG_ID3_YEAR));
- if (id3->year_string) {
- lcd_puts_scroll(0, 1, id3->year_string);
- }
- else if (id3->year) {
- snprintf(scroll_text,sizeof(scroll_text), "%d",
- id3->year);
- lcd_puts_scroll(0, 1, scroll_text);
- }
- else
- lcd_puts_scroll(0, 1, str(LANG_ID3_NO_INFO));
- break;
+ if (id3->year_string)
+ {
+ body = id3->year_string;
+ }
+ else if (id3->year)
+ {
+ snprintf(buf, sizeof(buf), "%d", id3->year);
+ body = buf;
+ }
+ else
+ {
+ body = NULL;
+ }
- case 6:
- lcd_puts(0, 0, str(LANG_ID3_LENGHT));
- wps_format_time(scroll_text, sizeof(scroll_text), id3->length);
- lcd_puts(0, 1, scroll_text);
- break;
+ line = draw_id3_item(line, top, LANG_ID3_YEAR, body);
- case 7:
- lcd_puts(0, 0, str(LANG_ID3_PLAYLIST));
- snprintf(scroll_text,sizeof(scroll_text), "%d/%d",
- playlist_get_display_index(), playlist_amount());
- lcd_puts_scroll(0, 1, scroll_text);
- break;
+ wps_format_time(buf, sizeof(buf), id3->length);
+ line = draw_id3_item(line, top, LANG_ID3_LENGHT, buf);
+ snprintf(buf, sizeof(buf), "%d/%d", playlist_get_display_index(),
+ playlist_amount());
+ line = draw_id3_item(line, top, LANG_ID3_PLAYLIST, buf);
- case 8:
- lcd_puts(0, 0, str(LANG_ID3_BITRATE));
- snprintf(scroll_text,sizeof(scroll_text), "%d kbps",
- id3->bitrate);
- lcd_puts(0, 1, scroll_text);
- break;
+ snprintf(buf, sizeof(buf), "%d kbps", id3->bitrate);
+ line = draw_id3_item(line, top, LANG_ID3_BITRATE, buf);
- case 9:
- lcd_puts(0, 0, str(LANG_ID3_FRECUENCY));
- snprintf(scroll_text,sizeof(scroll_text), "%d Hz",
- id3->frequency);
- lcd_puts(0, 1, scroll_text);
- break;
+ snprintf(buf, sizeof(buf), "%d Hz", id3->frequency);
+ line = draw_id3_item(line, top, LANG_ID3_FRECUENCY, buf);
- case 10:
- lcd_puts(0, 0, str(LANG_ID3_PATH));
- lcd_puts_scroll(0, 1, id3->path);
- break;
#if CONFIG_HWCODEC == MASNONE
- case 11:
- lcd_puts(0, 0, str(LANG_ID3_TRACK_GAIN));
- lcd_puts(0, 1, id3->track_gain_string
- ? id3->track_gain_string
- : (char*) str(LANG_ID3_NO_GAIN));
- break;
+ line = draw_id3_item(line, top, LANG_ID3_TRACK_GAIN,
+ id3->track_gain_string);
- case 12:
- lcd_puts(0, 0, str(LANG_ID3_ALBUM_GAIN));
- lcd_puts(0, 1, id3->album_gain_string
- ? id3->album_gain_string
- : (char*) str(LANG_ID3_NO_GAIN));
- break;
+ line = draw_id3_item(line, top, LANG_ID3_ALBUM_GAIN,
+ id3->album_gain_string);
#endif
- }
- lcd_update();
- button = button_get(true);
+ line = draw_id3_item(line, top, LANG_ID3_PATH, id3->path);
- switch(button)
+#if defined(HAVE_LCD_BITMAP)
+ if (show_scrollbar)
{
+ scrollbar(0, y_margin, SCROLLBAR_WIDTH - 1, rows * line_height,
+ ID3_ITEMS * 2 + (rows & 1), top, top + rows, VERTICAL);
+ }
+#endif
+
+ while (!exit && (top == old_top))
+ {
+ status_draw(false);
+ lcd_update();
+ button = button_get_w_tmo(HZ / 2);
+
+ switch(button)
+ {
+ /* It makes more sense to have the keys mapped "backwards" when
+ * scrolling a list.
+ */
+#if defined(HAVE_LCD_BITMAP)
+ case SETTINGS_INC:
+ case SETTINGS_INC | BUTTON_REPEAT:
+#else
case SETTINGS_DEC:
- if (menu_pos > 0)
- menu_pos--;
- else
- menu_pos = menu_max;
+#endif
+ if (top > 0)
+ {
+ top -= 2;
+ }
+ else if (!(button & BUTTON_REPEAT))
+ {
+ top = top_max;
+ }
+
break;
+#if defined(HAVE_LCD_BITMAP)
+ case SETTINGS_DEC:
+ case SETTINGS_DEC | BUTTON_REPEAT:
+#else
case SETTINGS_INC:
- if (menu_pos < menu_max)
- menu_pos++;
- else
- menu_pos = 0;
+#endif
+ if (top < top_max)
+ {
+ top += 2;
+ }
+ else if (!(button & BUTTON_REPEAT))
+ {
+ top = 0;
+ }
+
break;
#ifdef SETTINGS_OK2
@@ -1426,17 +1461,22 @@ bool browse_id3(void)
#endif
case SETTINGS_CANCEL:
lcd_stop_scroll();
- /* eat release event */
+ /* Eat release event */
button_get(true);
exit = true;
break;
default:
- if(default_event_handler(button) == SYS_USB_CONNECTED)
+ if (default_event_handler(button) == SYS_USB_CONNECTED)
+ {
return true;
+ }
+
break;
+ }
}
}
+
return false;
}