Icon code cleanup, optimisation & policeing. Removed unused icons. Applied uniform icon naming scheme.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7396 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-08-24 00:09:42 +00:00
parent 992cbf20a0
commit 6c00e38665
8 changed files with 74 additions and 80 deletions

View file

@ -527,11 +527,11 @@ int db_get_icon(struct tree_context* c)
case songs4album: case songs4album:
case songs4artist: case songs4artist:
case searchsongs: case searchsongs:
icon = File; icon = Icon_Audio;
break; break;
default: default:
icon = Folder; icon = Icon_Folder;
break; break;
} }

View file

@ -105,10 +105,10 @@ void filetype_init(void)
/* The special filetype folder must always be stored at index 0 */ /* The special filetype folder must always be stored at index 0 */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
if (!filetypes[0].icon) if (!filetypes[0].icon)
filetypes[0].icon = bitmap_icons_6x8[Folder]; filetypes[0].icon = bitmap_icons_6x8[Icon_Folder];
#else #else
if (!filetypes[0].icon) if (!filetypes[0].icon)
filetypes[0].icon = Folder; filetypes[0].icon = Icon_Folder;
for (i=1; i < MAX_FILETYPES; i++) for (i=1; i < MAX_FILETYPES; i++)
filetypes[i].icon = -1; filetypes[i].icon = -1;
#endif #endif
@ -370,9 +370,9 @@ static void scan_plugins(void)
exttypes[cnt_exttypes].extension=cp; exttypes[cnt_exttypes].extension=cp;
exttypes[cnt_exttypes].type=&filetypes[cnt_filetypes]; exttypes[cnt_exttypes].type=&filetypes[cnt_filetypes];
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
exttypes[cnt_exttypes].type->icon = bitmap_icons_6x8[Plugin]; exttypes[cnt_exttypes].type->icon = bitmap_icons_6x8[Icon_Plugin];
#else #else
exttypes[cnt_exttypes].type->icon = Plugin; exttypes[cnt_exttypes].type->icon = Icon_Plugin;
#endif #endif
cnt_exttypes++; cnt_exttypes++;

View file

@ -116,7 +116,7 @@ void put_cursorxy(int x, int y, bool on)
/* place the cursor */ /* place the cursor */
if(on) { if(on) {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_mono_bitmap(bitmap_icons_6x8[Cursor], xpos, ypos, 4, 8); lcd_mono_bitmap(bitmap_icons_6x8[Icon_Cursor], xpos, ypos, 4, 8);
#else #else
lcd_putc(x, y, CURSOR_CHAR); lcd_putc(x, y, CURSOR_CHAR);
#endif #endif

View file

@ -28,9 +28,17 @@
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
enum { enum {
Unknown = 0x90, Icon_Unknown = 0x90,
Bookmark = 0x16, Icon_Bookmark = 0x16,
Plugin, Folder, Mod_Ajz, Language, File, Wps, Playlist, Text, Config, Icon_Plugin,
Icon_Folder,
Icon_Firmware,
Icon_Language,
Icon_Audio,
Icon_Wps,
Icon_Playlist,
Icon_Text,
Icon_Config,
}; };
#endif #endif

View file

@ -461,11 +461,11 @@ static void display_playlist(void)
int offset=0; int offset=0;
if ( viewer.line_height > 8 ) if ( viewer.line_height > 8 )
offset = (viewer.line_height - 8) / 2; offset = (viewer.line_height - 8) / 2;
lcd_mono_bitmap(bitmap_icons_6x8[File], lcd_mono_bitmap(bitmap_icons_6x8[Icon_Audio],
CURSOR_X * 6 + CURSOR_WIDTH, CURSOR_X * 6 + CURSOR_WIDTH,
MARGIN_Y+(i*viewer.line_height) + offset, 6, 8); MARGIN_Y+(i*viewer.line_height) + offset, 6, 8);
#else #else
lcd_putc(LINE_X-1, i, File); lcd_putc(LINE_X-1, i, Icon_Audio);
#endif #endif
} }
else if (tracks[INDEX(i)].index == viewer.move_track) else if (tracks[INDEX(i)].index == viewer.move_track)

View file

@ -36,15 +36,9 @@ const unsigned char bitmap_icons_5x8[][5] =
const unsigned char bitmap_icons_6x8[LastIcon][6] = const unsigned char bitmap_icons_6x8[LastIcon][6] =
{ {
{ 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f }, /* Box_Filled */
{ 0x00, 0x7f, 0x41, 0x41, 0x41, 0x7f }, /* Box_Empty */
{ 0x00, 0x3e, 0x7f, 0x63, 0x7f, 0x3e }, /* Slider_Horizontal */
{ 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */ { 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */
{ 0x7e, 0x41, 0x41, 0x42, 0x7e, 0x00 }, /* Folder */ { 0x7e, 0x41, 0x41, 0x42, 0x7e, 0x00 }, /* Folder */
{ 0x3e, 0x26, 0x26, 0x24, 0x3c, 0x00 }, /* Directory */
{ 0x55, 0x00, 0x55, 0x55, 0x55, 0x55 }, /* Playlist */ { 0x55, 0x00, 0x55, 0x55, 0x55, 0x55 }, /* Playlist */
{ 0x39, 0x43, 0x47, 0x71, 0x61, 0x4e }, /* Repeat */
{ 0x00, 0x1c, 0x3e, 0x3e, 0x3e, 0x1c }, /* Selected */
{ 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00 }, /* Cursor / Marker */ { 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00 }, /* Cursor / Marker */
{ 0x58, 0x5f, 0x42, 0x50, 0x55, 0x55 }, /* WPS file */ { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x55 }, /* WPS file */
{ 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, /* Mod or ajz file */ { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, /* Mod or ajz file */
@ -59,7 +53,6 @@ const unsigned char bitmap_icons_7x8[][7] =
{ {
{0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */ {0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */
{0x1c,0x14,0x3e,0x2a,0x22,0x1c,0x08}, /* USB plug */ {0x1c,0x14,0x3e,0x2a,0x22,0x1c,0x08}, /* USB plug */
{0x00,0x1c,0x1c,0x3e,0x7f,0x00,0x00}, /* Speaker */
{0x01,0x1e,0x1c,0x3e,0x7f,0x20,0x40}, /* Speaker mute */ {0x01,0x1e,0x1c,0x3e,0x7f,0x20,0x40}, /* Speaker mute */
{0x00,0x7f,0x7f,0x3e,0x1c,0x08,0x00}, /* Play */ {0x00,0x7f,0x7f,0x3e,0x1c,0x08,0x00}, /* Play */
{0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f}, /* Stop */ {0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f}, /* Stop */
@ -82,7 +75,8 @@ const unsigned char bitmap_icon_disk[12] =
{0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f};
#endif #endif
#if LCD_WIDTH == 112 || LCD_WIDTH == 128 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \
|| (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128)
/* Archos Jukebox/ Ondio + Gmini LCD width / remote lcd of iriver*/ /* Archos Jukebox/ Ondio + Gmini LCD width / remote lcd of iriver*/
const unsigned char rockbox112x37[]={ const unsigned char rockbox112x37[]={
@ -347,7 +341,6 @@ const unsigned char rockbox160x53x2[] = {
*/ */
void statusbar_icon_battery(int percent) void statusbar_icon_battery(int percent)
{ {
int i;
int fill; int fill;
char buffer[5]; char buffer[5];
unsigned int width, height; unsigned int width, height;
@ -359,17 +352,13 @@ void statusbar_icon_battery(int percent)
if (fill > 100) if (fill > 100)
fill = 100; fill = 100;
#ifdef SIMULATOR #if defined(HAVE_CHARGE_CTRL) && !defined(SIMULATOR) /* Rec v1 target only */
if (global_settings.battery_display && (percent > -1)) {
#else
#ifdef HAVE_CHARGE_CTRL /* Recorder */
/* show graphical animation when charging instead of numbers */ /* show graphical animation when charging instead of numbers */
if ((global_settings.battery_display) && if ((global_settings.battery_display) &&
(charge_state != 1) && (charge_state != 1) &&
(percent > -1)) { (percent > -1)) {
#else /* FM */ #else /* all others */
if (global_settings.battery_display && (percent > -1)) { if (global_settings.battery_display && (percent > -1)) {
#endif /* HAVE_CHARGE_CTRL */
#endif #endif
/* Numeric display */ /* Numeric display */
snprintf(buffer, sizeof(buffer), "%3d", fill); snprintf(buffer, sizeof(buffer), "%3d", fill);
@ -384,11 +373,10 @@ void statusbar_icon_battery(int percent)
else { else {
/* draw battery */ /* draw battery */
lcd_drawrect(ICON_BATTERY_X_POS, STATUSBAR_Y_POS, 17, 7); lcd_drawrect(ICON_BATTERY_X_POS, STATUSBAR_Y_POS, 17, 7);
for (i=2; i < 5; i++) lcd_vline(ICON_BATTERY_X_POS + 17, STATUSBAR_Y_POS + 2,
lcd_drawpixel(ICON_BATTERY_X_POS + 17, STATUSBAR_Y_POS + i); STATUSBAR_Y_POS + 4);
fill = fill * 15 / 100; fill = fill * 15 / 100;
lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5); lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5);
} }
@ -405,17 +393,13 @@ void statusbar_icon_battery(int percent)
*/ */
bool statusbar_icon_volume(int percent) bool statusbar_icon_volume(int percent)
{ {
int i,j; int i;
int volume; int volume;
int vol; int vol;
int step=0;
char buffer[4]; char buffer[4];
unsigned int width, height; unsigned int width, height;
bool needs_redraw = false; bool needs_redraw = false;
int type = global_settings.volume_type; int type = global_settings.volume_type;
#if defined(LOADABLE_FONTS)
unsigned char *font;
#endif
static long switch_tick; static long switch_tick;
static int last_volume = -1; /* -1 means "first update ever" */ static int last_volume = -1; /* -1 means "first update ever" */
@ -457,11 +441,8 @@ bool statusbar_icon_volume(int percent)
/* display volume bar */ /* display volume bar */
vol = volume * 14 / 100; vol = volume * 14 / 100;
for(i=0; i < vol; i++) { for(i=0; i < vol; i++) {
if(i%2 == 0) lcd_vline(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 6 - i / 2,
step++; STATUSBAR_Y_POS + 6);
for(j=1; j <= step; j++)
lcd_drawpixel(ICON_VOLUME_X_POS + i,
STATUSBAR_Y_POS + 7 - j);
} }
} }
} }
@ -475,8 +456,8 @@ bool statusbar_icon_volume(int percent)
*/ */
void statusbar_icon_play_state(int state) void statusbar_icon_play_state(int state)
{ {
lcd_mono_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS, lcd_mono_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS,
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT); STATUSBAR_Y_POS, ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
} }
/* /*
@ -484,8 +465,8 @@ void statusbar_icon_play_state(int state)
*/ */
void statusbar_icon_play_mode(int mode) void statusbar_icon_play_mode(int mode)
{ {
lcd_mono_bitmap(bitmap_icons_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS, lcd_mono_bitmap(bitmap_icons_7x8[mode], ICON_PLAY_MODE_X_POS,
ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT); STATUSBAR_Y_POS, ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT);
} }
/* /*

View file

@ -27,24 +27,29 @@
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
enum icons_6x8 {
Box_Filled, Box_Empty, Slider_Horizontal, File,
Folder, Directory, Playlist, Repeat,
Selected, Cursor, Wps, Mod_Ajz,
Font, Language, Config, Plugin,
Bookmark,
LastIcon
};
/* Symbolic names for icons */ /* Symbolic names for icons */
enum icons_5x8 { enum icons_5x8 {
Icon_Lock Icon_Lock
}; };
enum icons_6x8 {
Icon_Audio,
Icon_Folder,
Icon_Playlist,
Icon_Cursor,
Icon_Wps,
Icon_Firmware,
Icon_Font,
Icon_Language,
Icon_Config,
Icon_Plugin,
Icon_Bookmark,
LastIcon
};
enum icons_7x8 { enum icons_7x8 {
Icon_Plug, Icon_Plug,
Icon_USBPlug, Icon_USBPlug,
Icon_Speaker,
Icon_Mute, Icon_Mute,
Icon_Play, Icon_Play,
Icon_Stop, Icon_Stop,

View file

@ -68,32 +68,32 @@
/* a table for the know file types */ /* a table for the know file types */
const struct filetype filetypes[] = { const struct filetype filetypes[] = {
{ ".mp3", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".mp3", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".mp2", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".mp2", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".mpa", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".mpa", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
#if CONFIG_HWCODEC == MASNONE #if CONFIG_HWCODEC == MASNONE
/* Temporary hack to allow playlist creation */ /* Temporary hack to allow playlist creation */
{ ".mp1", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".mp1", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".ogg", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".ogg", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".wma", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".wma", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".wav", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".wav", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".flac", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".flac", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".ac3", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".ac3", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".a52", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".a52", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".mpc", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".mpc", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
{ ".wv", TREE_ATTR_MPA, File, VOICE_EXT_MPA }, { ".wv", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
#endif #endif
{ ".m3u", TREE_ATTR_M3U, Playlist, LANG_PLAYLIST }, { ".m3u", TREE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST },
{ ".cfg", TREE_ATTR_CFG, Config, VOICE_EXT_CFG }, { ".cfg", TREE_ATTR_CFG, Icon_Config, VOICE_EXT_CFG },
{ ".wps", TREE_ATTR_WPS, Wps, VOICE_EXT_WPS }, { ".wps", TREE_ATTR_WPS, Icon_Wps, VOICE_EXT_WPS },
{ ".lng", TREE_ATTR_LNG, Language, LANG_LANGUAGE }, { ".lng", TREE_ATTR_LNG, Icon_Language, LANG_LANGUAGE },
{ ".rock",TREE_ATTR_ROCK,Plugin, VOICE_EXT_ROCK }, { ".rock",TREE_ATTR_ROCK,Icon_Plugin, VOICE_EXT_ROCK },
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
{ ".fnt", TREE_ATTR_FONT,Font, VOICE_EXT_FONT }, { ".fnt", TREE_ATTR_FONT,Icon_Font, VOICE_EXT_FONT },
#endif #endif
{ ".bmark",TREE_ATTR_BMARK, Bookmark, VOICE_EXT_BMARK }, { ".bmark",TREE_ATTR_BMARK, Icon_Bookmark, VOICE_EXT_BMARK },
#ifdef BOOTFILE_EXT #ifdef BOOTFILE_EXT
{ BOOTFILE_EXT, TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ }, { BOOTFILE_EXT, TREE_ATTR_MOD, Icon_Firmware, VOICE_EXT_AJZ },
#endif /* #ifndef SIMULATOR */ #endif /* #ifndef SIMULATOR */
}; };
@ -400,7 +400,7 @@ static int showdir(void)
MARGIN_Y+(i-start)*line_height + offset, 6, 8); MARGIN_Y+(i-start)*line_height + offset, 6, 8);
#else #else
if (icon < 0 ) if (icon < 0 )
icon = Unknown; icon = Icon_Unknown;
lcd_putc(LINE_X-1, i-start, icon); lcd_putc(LINE_X-1, i-start, icon);
#endif #endif
} }