summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-04-16 14:33:29 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-04-16 14:33:29 +0000
commita9c1df40014ebe548ab111fd28d854f22e231b5f (patch)
treeb663992bcc82b56095900dd378cc1eb8dfa81a6a /apps
parentb6658bbeef45b3b2db730bb8ca2bf0309d2ca917 (diff)
downloadrockbox-a9c1df40014ebe548ab111fd28d854f22e231b5f.zip
rockbox-a9c1df40014ebe548ab111fd28d854f22e231b5f.tar.gz
rockbox-a9c1df40014ebe548ab111fd28d854f22e231b5f.tar.bz2
rockbox-a9c1df40014ebe548ab111fd28d854f22e231b5f.tar.xz
* its name[rows][columns] you drongo!
* make custom viewer icons work slightly better * minor nit-picks to keep crop happy * create a /.rockbox/themes/default_rockbox_icons.cfg to restore the default icons easily git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13183 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/filetypes.c15
-rw-r--r--apps/gui/icon.c16
-rw-r--r--apps/gui/icon.h5
-rw-r--r--apps/settings.h2
-rw-r--r--apps/settings_list.c2
5 files changed, 27 insertions, 13 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 25dc0fe..832d677 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -63,6 +63,8 @@ struct file_type {
char* extension; /* NULL for none */
};
static struct file_type filetypes[MAX_FILETYPES];
+static int custom_filetype_icons[MAX_FILETYPES];
+static bool custom_icons_loaded = false;
static int filetype_count = 0;
static unsigned char heighest_attr = 0;
@@ -81,6 +83,10 @@ void read_viewer_theme_file(void)
int fd;
char *ext, *icon;
int i;
+ custom_icons_loaded = false;
+ for (i=0; i<filetype_count; i++)
+ custom_filetype_icons[i] = Icon_Questionmark;
+
snprintf(buffer, MAX_PATH, "%s/%s.icons", ICON_DIR,
global_settings.viewers_icon_file);
fd = open(buffer, O_RDONLY);
@@ -95,16 +101,17 @@ void read_viewer_theme_file(void)
if (filetypes[i].extension && !strcasecmp(ext, filetypes[i].extension))
{
if (*icon == '*')
- filetypes[i].icon = atoi(icon+1);
+ custom_filetype_icons[i] = atoi(icon+1);
else if (*icon == '-')
- filetypes[i].icon = Icon_NOICON;
+ custom_filetype_icons[i] = Icon_NOICON;
else if (*icon >= '0' && *icon <= '9')
- filetypes[i].icon = Icon_Last_Themeable + atoi(icon);
+ custom_filetype_icons[i] = Icon_Last_Themeable + atoi(icon);
break;
}
}
}
close(fd);
+ custom_icons_loaded = true;
}
#endif
@@ -258,6 +265,8 @@ int filetype_get_icon(int attr)
int index = find_attr(attr);
if (index < 0)
return Icon_NOICON;
+ if (custom_icons_loaded)
+ return custom_filetype_icons[index];
return filetypes[index].icon;
}
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index b844b4b..6e4cd59 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -74,11 +74,11 @@ static const int default_height[NB_SCREENS] = {
#define IMG_BUFSIZE (MAX_ICON_HEIGHT * MAX_ICON_WIDTH * \
Icon_Last_Themeable *LCD_DEPTH/8)
-static unsigned char icon_buffer[IMG_BUFSIZE][NB_SCREENS];
+static unsigned char icon_buffer[NB_SCREENS][IMG_BUFSIZE];
static bool custom_icons_loaded[NB_SCREENS] = {false};
static struct bitmap user_iconset[NB_SCREENS];
-static unsigned char viewer_icon_buffer[IMG_BUFSIZE][NB_SCREENS];
+static unsigned char viewer_icon_buffer[NB_SCREENS][IMG_BUFSIZE];
static bool viewer_icons_loaded[NB_SCREENS] = {false};
static struct bitmap viewer_iconset[NB_SCREENS];
@@ -252,13 +252,15 @@ void icons_init(void)
{
snprintf(path, MAX_PATH, "%s/%s.bmp",
ICON_DIR, global_settings.icon_file);
- load_icons(path, Iconset_Mainscreen);
+ load_icons((global_settings.icon_file[0] == '-')?NULL:path,
+ Iconset_Mainscreen);
}
if (global_settings.viewers_icon_file[0])
{
snprintf(path, MAX_PATH, "%s/%s.bmp",
ICON_DIR, global_settings.viewers_icon_file);
- load_icons(path, Iconset_Mainscreen_viewers);
+ load_icons((global_settings.viewers_icon_file[0] == '-')?NULL:path,
+ Iconset_Mainscreen_viewers);
read_viewer_theme_file();
}
else
@@ -268,13 +270,15 @@ void icons_init(void)
{
snprintf(path, MAX_PATH, "%s/%s.bmp",
ICON_DIR, global_settings.remote_icon_file);
- load_icons(path, Iconset_Remotescreen);
+ load_icons((global_settings.remote_icon_file[0] == '-')?NULL:path,
+ Iconset_Remotescreen);
}
if (global_settings.remote_viewers_icon_file[0])
{
snprintf(path, MAX_PATH, "%s/%s.bmp",
ICON_DIR, global_settings.remote_viewers_icon_file);
- load_icons(path, Iconset_Remotescreen_viewers);
+ load_icons((global_settings.remote_viewers_icon_file[0] == '-')?NULL:path,
+ Iconset_Remotescreen_viewers);
}
else
load_icons(DEFAULT_REMOTE_VIEWER_BMP, Iconset_Remotescreen_viewers);
diff --git a/apps/gui/icon.h b/apps/gui/icon.h
index fa69190..8408ed4 100644
--- a/apps/gui/icon.h
+++ b/apps/gui/icon.h
@@ -24,15 +24,14 @@
* char-based displays and bitmap displays */
#ifdef HAVE_LCD_BITMAP
typedef const unsigned char * ICON;
-#define NOICON Icon_NOICON
#else
typedef long ICON;
-#define NOICON Icon_NOICON
#endif
+#define NOICON Icon_NOICON
#define FORCE_INBUILT_ICON 0x80000000
/* Don't #ifdef icon values, or we wont be able to use the same
- cmp for every target. */
+ bmp for every target. */
enum themable_icons {
Icon_NOICON = -1, /* Dont put this in a .bmp */
Icon_Audio,
diff --git a/apps/settings.h b/apps/settings.h
index c27b6e6..1fee6b4 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -708,8 +708,10 @@ struct user_settings
int alarm_wake_up_screen;
#endif
/* customizable icons */
+#ifdef HAVE_LCD_BITMAP
unsigned char icon_file[MAX_FILENAME+1];
unsigned char viewers_icon_file[MAX_FILENAME+1];
+#endif
#ifdef HAVE_REMOTE_LCD
unsigned char remote_icon_file[MAX_FILENAME+1];
unsigned char remote_viewers_icon_file[MAX_FILENAME+1];
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 2ebce0e..ce45074 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1167,13 +1167,13 @@ const struct settings_list settings[] = {
ICON_DIR "/", ".bmp", MAX_FILENAME+1),
FILENAME_SETTING(F_THEMESETTING, viewers_icon_file, "viewers iconset", "",
ICON_DIR "/", ".bmp", MAX_FILENAME+1),
+#endif
#ifdef HAVE_REMOTE_LCD
FILENAME_SETTING(F_THEMESETTING, remote_icon_file, "remote iconset", "",
ICON_DIR "/", ".bmp", MAX_FILENAME+1),
FILENAME_SETTING(F_THEMESETTING, remote_viewers_icon_file,
"remote viewers iconset", "",
ICON_DIR "/", ".bmp", MAX_FILENAME+1),
-#endif
#endif /* HAVE_REMOTE_LCD */
};