1
0
Fork 0
forked from len0rd/rockbox

Updated ID3 info screen for devices with a bitmapped screen: show a list of all items, rather than item one at a time.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7302 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2005-08-11 18:21:14 +00:00
parent 591d2890f1
commit eab21c6cb5
2 changed files with 210 additions and 170 deletions

View file

@ -11,7 +11,7 @@
# If you re-order things or remove entries, you must bump the binary language # 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. # 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 id: LANG_SOUND_SETTINGS
desc: in the main menu desc: in the main menu
@ -233,7 +233,7 @@ id: LANG_RESET_ASK_RECORDER
desc: confirm to reset settings desc: confirm to reset settings
eng: "Are You Sure?" eng: "Are You Sure?"
voice: "" voice: ""
new: new:
id: LANG_RESET_DONE_SETTING id: LANG_RESET_DONE_SETTING
desc: visual confirmation after settings reset desc: visual confirmation after settings reset
@ -470,20 +470,20 @@ voice: ""
new: new:
id: LANG_ID3_NO_TITLE id: LANG_ID3_NO_TITLE
desc: in wps when no title is avaible desc: DEPRECATED
eng: "<No Title>" eng: ""
voice: "" voice: ""
new: new:
id: LANG_ID3_ARTIST id: LANG_ID3_ARTIST
desc: in wps desc: in wps
eng: "[Artist]" eng: "[Artist]"
voice: "" voice: ""
new: new:
id: LANG_ID3_NO_ARTIST id: LANG_ID3_NO_ARTIST
desc: in wps when no artist is avaible desc: DEPRECATED
eng: "<No Artist>" eng: ""
voice: "" voice: ""
new: new:
@ -494,8 +494,8 @@ voice: ""
new: new:
id: LANG_ID3_NO_ALBUM id: LANG_ID3_NO_ALBUM
desc: in wps when no album is avaible desc: DEPRECATED
eng: "<No Album>" eng: ""
voice: "" voice: ""
new: new:
@ -506,8 +506,8 @@ voice: ""
new: new:
id: LANG_ID3_NO_TRACKNUM id: LANG_ID3_NO_TRACKNUM
desc: in wps if no track number is avaible desc: DEPRECATED
eng: "<No Tracknum>" eng: ""
voice: "" voice: ""
new: new:
@ -539,7 +539,7 @@ id: LANG_ID3_PATH
desc: in wps desc: in wps
eng: "[Path]" eng: "[Path]"
voice: "" voice: ""
new: new:
id: LANG_PITCH_UP id: LANG_PITCH_UP
desc: in wps desc: in wps
@ -593,7 +593,7 @@ id: LANG_END_PLAYLIST_RECORDER
desc: when playlist has finished desc: when playlist has finished
eng: "End Of Song List" eng: "End Of Song List"
voice: "" voice: ""
new: new:
id: LANG_POWEROFF_IDLE id: LANG_POWEROFF_IDLE
desc: in settings_menu desc: in settings_menu
@ -647,37 +647,37 @@ id: LANG_PM_MENU
desc: in the display menu desc: in the display menu
eng: "Peak Meter" eng: "Peak Meter"
voice: "Peak Meter" voice: "Peak Meter"
new: new:
id: LANG_PM_RELEASE id: LANG_PM_RELEASE
desc: in the peak meter menu desc: in the peak meter menu
eng: "Peak Release" eng: "Peak Release"
voice: "Peak Release" voice: "Peak Release"
new: new:
id: LANG_PM_PEAK_HOLD id: LANG_PM_PEAK_HOLD
desc: in the peak meter menu desc: in the peak meter menu
eng: "Peak Hold Time" eng: "Peak Hold Time"
voice: "Peak Hold Time" voice: "Peak Hold Time"
new: new:
id: LANG_PM_CLIP_HOLD id: LANG_PM_CLIP_HOLD
desc: in the peak meter menu desc: in the peak meter menu
eng: "Clip Hold Time" eng: "Clip Hold Time"
voice: "Clip Hold Time" voice: "Clip Hold Time"
new: new:
id: LANG_PM_ETERNAL id: LANG_PM_ETERNAL
desc: in the peak meter menu desc: in the peak meter menu
eng: "Eternal" eng: "Eternal"
voice: "Eternal" voice: "Eternal"
new: new:
id: LANG_PM_UNITS_PER_READ id: LANG_PM_UNITS_PER_READ
desc: in the peak meter menu desc: in the peak meter menu
eng: "Units Per Read" eng: "Units Per Read"
voice: "Units Per Read" voice: "Units Per Read"
new: new:
id: LANG_BACKLIGHT_ON_WHEN_CHARGING id: LANG_BACKLIGHT_ON_WHEN_CHARGING
desc: in display_settings_menu desc: in display_settings_menu
@ -708,7 +708,7 @@ desc: confirm to reset settings
eng: "PLAY=Reset" eng: "PLAY=Reset"
voice: "" voice: ""
new: new:
id: LANG_RESET_CANCEL id: LANG_RESET_CANCEL
desc: confirm to reset settings desc: confirm to reset settings
eng: "OFF=Cancel" eng: "OFF=Cancel"
@ -1133,43 +1133,43 @@ id: LANG_FAILED
desc: Something failed. To be appended after above actions desc: Something failed. To be appended after above actions
eng: "Failed" eng: "Failed"
voice: "" voice: ""
new: new:
id: LANG_ALARM_MOD_ALARM_MENU id: LANG_ALARM_MOD_ALARM_MENU
desc: The name of the additional entry in the main menu for the RTC alarm mod. desc: The name of the additional entry in the main menu for the RTC alarm mod.
eng: "Wake-Up Alarm" eng: "Wake-Up Alarm"
voice: "Wake-Up Alarm" voice: "Wake-Up Alarm"
new: new:
id: LANG_ALARM_MOD_TIME id: LANG_ALARM_MOD_TIME
desc: The current alarm time shown in the alarm menu for the RTC alarm mod. desc: The current alarm time shown in the alarm menu for the RTC alarm mod.
eng: "Alarm Time: %02d:%02d" eng: "Alarm Time: %02d:%02d"
voice: "" voice: ""
new: new:
id: LANG_ALARM_MOD_TIME_TO_GO 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. 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" eng: "Waking Up In %d:%02d"
voice: "" voice: ""
new: new:
id: LANG_ALARM_MOD_SHUTDOWN 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). 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" eng: "Alarm Set"
voice: "" voice: ""
new: new:
id: LANG_ALARM_MOD_ERROR id: LANG_ALARM_MOD_ERROR
desc: The text that tells that the time is incorrect (for the RTC alarm mod). desc: The text that tells that the time is incorrect (for the RTC alarm mod).
eng: "Alarm Time Is Too Soon!" eng: "Alarm Time Is Too Soon!"
voice: "" voice: ""
new: new:
id: LANG_ALARM_MOD_KEYS id: LANG_ALARM_MOD_KEYS
desc: Shown key functions in alarm menu (for the RTC alarm mod). desc: Shown key functions in alarm menu (for the RTC alarm mod).
eng: "PLAY=Set OFF=Cancel" eng: "PLAY=Set OFF=Cancel"
voice: "" voice: ""
new: new:
id: LANG_CREATE_PLAYLIST id: LANG_CREATE_PLAYLIST
desc: Menu option for creating a 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 desc: Feedback shown when a .cfg file is loaded
eng: "Loaded" eng: "Loaded"
voice: "" voice: ""
new: new:
id: LANG_FADE_ON_STOP id: LANG_FADE_ON_STOP
desc: options menu to set fade on stop or pause desc: options menu to set fade on stop or pause
@ -1301,37 +1301,37 @@ id: LANG_SAVE_SETTINGS
desc: in system_settings_menu() desc: in system_settings_menu()
eng: "Write .cfg file" eng: "Write .cfg file"
voice: "Write configuration file" voice: "Write configuration file"
new: new:
id: LANG_SETTINGS_SAVED1 id: LANG_SETTINGS_SAVED1
desc: Feedback shown when a .cfg file is saved desc: Feedback shown when a .cfg file is saved
eng: "Settings" eng: "Settings"
voice: "" voice: ""
new: new:
id: LANG_SETTINGS_SAVED2 id: LANG_SETTINGS_SAVED2
desc: Feedback shown when a .cfg file is saved desc: Feedback shown when a .cfg file is saved
eng: "Saved" eng: "Saved"
voice: "" voice: ""
new: new:
id: LANG_VBRFIX_STOP_PLAY id: LANG_VBRFIX_STOP_PLAY
desc: DEPRECATED desc: DEPRECATED
eng: "" eng: ""
voice: "" voice: ""
new: new:
id: LANG_VBRFIX_NOT_VBR id: LANG_VBRFIX_NOT_VBR
desc: DEPRECATED desc: DEPRECATED
eng: "" eng: ""
voice: "" voice: ""
new: new:
id: LANG_VBRFIX id: LANG_VBRFIX
desc: DEPRECATED desc: DEPRECATED
eng: "" eng: ""
voice: "" voice: ""
new: new:
id: LANG_INVERT_CURSOR id: LANG_INVERT_CURSOR
desc: in settings_menu desc: in settings_menu
@ -1663,7 +1663,7 @@ id: LANG_CAR_ADAPTER_MODE
desc: Displayed for setting car adapter mode to on/off desc: Displayed for setting car adapter mode to on/off
eng: "Car Adapter Mode" eng: "Car Adapter Mode"
voice: "Car Adapter Mode" voice: "Car Adapter Mode"
new: new:
id: LANG_LINE_IN id: LANG_LINE_IN
desc: in settings_menu desc: in settings_menu
@ -3234,8 +3234,8 @@ voice ""
new: new:
id: LANG_ID3_NO_GAIN id: LANG_ID3_NO_GAIN
desc: in browse_id3 desc: DEPRECATED
eng: "<No gain>" eng: ""
voice "" voice ""
new: new:

View file

@ -46,11 +46,16 @@
#include "led.h" #include "led.h"
#include "sound.h" #include "sound.h"
#include "wps-display.h" #include "wps-display.h"
#if defined(HAVE_LCD_BITMAP)
#include "widgets.h"
#endif
#ifdef HAVE_MMC #ifdef HAVE_MMC
#include "ata_mmc.h" #include "ata_mmc.h"
#endif #endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#define SCROLLBAR_WIDTH 6
#define BMPHEIGHT_usb_logo 32 #define BMPHEIGHT_usb_logo 32
#define BMPWIDTH_usb_logo 100 #define BMPWIDTH_usb_logo 100
static const unsigned char usb_logo[] = { static const unsigned char usb_logo[] = {
@ -1269,156 +1274,186 @@ bool shutdown_screen(void)
} }
#endif #endif
int draw_id3_item(int line, int top, int header, const char* body)
{
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
#define ID3_ITEMS 13
#else
#define ID3_ITEMS 11
#endif
bool browse_id3(void) bool browse_id3(void)
{ {
struct mp3entry* id3 = audio_current_track(); char buf[32];
int button; const struct mp3entry* id3 = audio_current_track();
int menu_pos = 0; #if defined(HAVE_LCD_BITMAP)
#if CONFIG_HWCODEC == MASNONE const int y_margin = lcd_getymargin();
int menu_max = 12; 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 #else
int menu_max = 10; const int rows = 2;
#endif #endif
const int top_max = (ID3_ITEMS * 2) - (rows & ~1);
int top = 0;
int button;
bool exit = false; bool exit = false;
char scroll_text[MAX_PATH];
if (!(audio_status() & AUDIO_STATUS_PLAY)) if (!id3 || (!(audio_status() & AUDIO_STATUS_PLAY)))
{
return false; return false;
}
#if defined(HAVE_LCD_BITMAP)
lcd_setmargins(show_scrollbar ? SCROLLBAR_WIDTH : 0, y_margin);
#endif
while (!exit) while (!exit)
{ {
int line = 0;
int old_top = top;
char* body;
lcd_clear_display(); 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: body = id3->track_string;
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;
case 4:
lcd_puts(0, 0, str(LANG_ID3_GENRE));
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;
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;
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;
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;
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;
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;
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;
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;
#endif
} }
lcd_update(); else if (id3->tracknum)
button = button_get(true);
switch(button)
{ {
snprintf(buf, sizeof(buf), "%d", id3->tracknum);
body = buf;
}
else
{
body = NULL;
}
line = draw_id3_item(line, top, LANG_ID3_TRACKNUM, body);
body = id3->genre_string ? id3->genre_string : id3_get_genre(id3);
line = draw_id3_item(line, top, LANG_ID3_GENRE, body);
if (id3->year_string)
{
body = id3->year_string;
}
else if (id3->year)
{
snprintf(buf, sizeof(buf), "%d", id3->year);
body = buf;
}
else
{
body = NULL;
}
line = draw_id3_item(line, top, LANG_ID3_YEAR, body);
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);
snprintf(buf, sizeof(buf), "%d kbps", id3->bitrate);
line = draw_id3_item(line, top, LANG_ID3_BITRATE, buf);
snprintf(buf, sizeof(buf), "%d Hz", id3->frequency);
line = draw_id3_item(line, top, LANG_ID3_FRECUENCY, buf);
#if CONFIG_HWCODEC == MASNONE
line = draw_id3_item(line, top, LANG_ID3_TRACK_GAIN,
id3->track_gain_string);
line = draw_id3_item(line, top, LANG_ID3_ALBUM_GAIN,
id3->album_gain_string);
#endif
line = draw_id3_item(line, top, LANG_ID3_PATH, id3->path);
#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: case SETTINGS_DEC:
if (menu_pos > 0) #endif
menu_pos--; if (top > 0)
else {
menu_pos = menu_max; top -= 2;
}
else if (!(button & BUTTON_REPEAT))
{
top = top_max;
}
break; break;
#if defined(HAVE_LCD_BITMAP)
case SETTINGS_DEC:
case SETTINGS_DEC | BUTTON_REPEAT:
#else
case SETTINGS_INC: case SETTINGS_INC:
if (menu_pos < menu_max) #endif
menu_pos++; if (top < top_max)
else {
menu_pos = 0; top += 2;
}
else if (!(button & BUTTON_REPEAT))
{
top = 0;
}
break; break;
#ifdef SETTINGS_OK2 #ifdef SETTINGS_OK2
@ -1426,17 +1461,22 @@ bool browse_id3(void)
#endif #endif
case SETTINGS_CANCEL: case SETTINGS_CANCEL:
lcd_stop_scroll(); lcd_stop_scroll();
/* eat release event */ /* Eat release event */
button_get(true); button_get(true);
exit = true; exit = true;
break; break;
default: default:
if(default_event_handler(button) == SYS_USB_CONNECTED) if (default_event_handler(button) == SYS_USB_CONNECTED)
{
return true; return true;
}
break; break;
}
} }
} }
return false; return false;
} }