summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2009-12-21 13:32:43 +0000
committerTeruaki Kawashima <teru@rockbox.org>2009-12-21 13:32:43 +0000
commita2fc6415708d2e0bdc83898eda749515046fad90 (patch)
tree60aace79c43ea10e721dd6e8a715f50c4643dab5 /apps
parent847ac057af1a17a60ab1c9ef4fd5769ae5b22581 (diff)
downloadrockbox-a2fc6415708d2e0bdc83898eda749515046fad90.tar.gz
rockbox-a2fc6415708d2e0bdc83898eda749515046fad90.tar.bz2
rockbox-a2fc6415708d2e0bdc83898eda749515046fad90.zip
properties,shortcuts_view: enable the theme while showing list.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24092 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/plugin.h7
-rw-r--r--apps/plugins/properties.c32
-rw-r--r--apps/plugins/shortcuts/shortcuts_view.c24
4 files changed, 54 insertions, 13 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index ca23134725..3836d76d28 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -676,6 +676,10 @@ static const struct plugin_api rockbox_api = {
#endif
crc_32,
open_utf8,
+#ifdef HAVE_LCD_BITMAP
+ viewportmanager_theme_enable,
+ viewportmanager_theme_undo,
+#endif
};
int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 8e5f474232..632533cb47 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -135,7 +135,7 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 177
+#define PLUGIN_API_VERSION 178
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -855,6 +855,11 @@ struct plugin_api {
#endif
unsigned (*crc_32)(const void *src, unsigned len, unsigned crc32);
int (*open_utf8)(const char* pathname, int flags);
+#ifdef HAVE_LCD_BITMAP
+ void (*viewportmanager_theme_enable)(enum screen_type screen, bool enable,
+ struct viewport *viewport);
+ void (*viewportmanager_theme_undo)(enum screen_type screen, bool force_redraw);
+#endif
};
/* plugin header */
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index 7cd29c126f..9d9020f023 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -172,7 +172,7 @@ static bool _dir_properties(DPS* dps)
entry->d_name);
if (entry->attribute & ATTR_DIRECTORY)
- {
+ {
if (!rb->strcmp((char *)entry->d_name, ".") ||
!rb->strcmp((char *)entry->d_name, ".."))
continue; /* skip these */
@@ -195,7 +195,7 @@ static bool _dir_properties(DPS* dps)
result = _dir_properties(dps);
}
else
- {
+ {
dps->fc++; /* new file */
dps->bc += entry->size;
}
@@ -272,8 +272,11 @@ static const char * get_props(int selected_item, void* data,
enum plugin_status plugin_start(const void* parameter)
{
struct gui_synclist properties_lists;
+#ifdef HAVE_LCD_BITMAP
+ int i;
+#endif
int button;
- bool quit = false;
+ bool quit = false, usb = false;
char file[MAX_PATH];
if(!parameter) return PLUGIN_ERROR;
rb->strcpy(file, (const char *) parameter);
@@ -301,7 +304,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->closedir(dir);
}
/* now we know if it's a file or a dir or maybe something failed */
-
+
if(!found)
{
/* weird: we couldn't find the entry. This Should Never Happen (TM) */
@@ -319,6 +322,11 @@ enum plugin_status plugin_start(const void* parameter)
return PLUGIN_OK;
}
+#ifdef HAVE_LCD_BITMAP
+ FOR_NB_SCREENS(i)
+ rb->viewportmanager_theme_enable(i, true, NULL);
+#endif
+
rb->gui_synclist_init(&properties_lists, &get_props, file, false, 1, NULL);
rb->gui_synclist_set_title(&properties_lists, its_a_dir ?
"Directory properties" :
@@ -331,7 +339,8 @@ enum plugin_status plugin_start(const void* parameter)
while(!quit)
{
- button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
+ button = rb->get_action(CONTEXT_LIST, HZ);
+ /* HZ so the status bar redraws corectly */
if (rb->gui_synclist_do_button(&properties_lists,&button,LIST_WRAP_ON))
continue;
switch(button)
@@ -341,9 +350,18 @@ enum plugin_status plugin_start(const void* parameter)
break;
default:
if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
- return PLUGIN_USB_CONNECTED;
+ {
+ quit = true;
+ usb = true;
+ }
+ break;
}
}
- return PLUGIN_OK;
+#ifdef HAVE_LCD_BITMAP
+ FOR_NB_SCREENS(i)
+ rb->viewportmanager_theme_undo(i, false);
+#endif
+
+ return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK;
}
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c
index b964968737..a63e26d7c6 100644
--- a/apps/plugins/shortcuts/shortcuts_view.c
+++ b/apps/plugins/shortcuts/shortcuts_view.c
@@ -58,7 +58,8 @@ enum sc_list_action_type draw_sc_list(struct gui_synclist *gui_sc)
while (true) {
/* user input */
- button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
+ button = rb->get_action(CONTEXT_LIST, HZ);
+ /* HZ so the status bar redraws corectly */
if (rb->gui_synclist_do_button(gui_sc, &button,
LIST_WRAP_UNLESS_HELD)) {
/* automatic handling of user input.
@@ -93,7 +94,7 @@ static const char* build_sc_list(int selected_item, void *data,
char *buffer, size_t buffer_len)
{
sc_file_t *file = (sc_file_t*)data;
-
+
if (!is_valid_index(file, selected_item)) {
return NULL;
}
@@ -154,7 +155,7 @@ bool list_sc(void)
bool goto_entry(char *file_or_dir)
{
DEBUGF("Trying to go to '%s'...\n", file_or_dir);
-
+
bool is_dir = ends_with(file_or_dir, PATH_SEPARATOR);
bool exists;
char *what;
@@ -194,8 +195,11 @@ bool ends_with(char *string, char *suffix)
enum plugin_status plugin_start(const void* void_parameter)
{
+#ifdef HAVE_LCD_BITMAP
+ int i;
+#endif
bool leave_loop;
-
+
/* This is a viewer, so a parameter must have been specified */
if (void_parameter == NULL) {
rb->splash(HZ*2, "No parameter specified!");
@@ -221,11 +225,21 @@ enum plugin_status plugin_start(const void* void_parameter)
goto_entry(sc_file.entries[0].path);
return PLUGIN_OK;
}
-
+
+#ifdef HAVE_LCD_BITMAP
+ FOR_NB_SCREENS(i)
+ rb->viewportmanager_theme_enable(i, true, NULL);
+#endif
+
do {
/* Display a menu to choose between the entries */
leave_loop = list_sc();
} while (!leave_loop);
+#ifdef HAVE_LCD_BITMAP
+ FOR_NB_SCREENS(i)
+ rb->viewportmanager_theme_undo(i, false);
+#endif
+
return usb_connected ? PLUGIN_USB_CONNECTED : PLUGIN_OK;
}