properties,shortcuts_view: enable the theme while showing list.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24092 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2009-12-21 13:32:43 +00:00
parent 847ac057af
commit a2fc641570
4 changed files with 54 additions and 13 deletions

View file

@ -676,6 +676,10 @@ static const struct plugin_api rockbox_api = {
#endif #endif
crc_32, crc_32,
open_utf8, open_utf8,
#ifdef HAVE_LCD_BITMAP
viewportmanager_theme_enable,
viewportmanager_theme_undo,
#endif
}; };
int plugin_load(const char* plugin, const void* parameter) int plugin_load(const char* plugin, const void* parameter)

View file

@ -135,7 +135,7 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* 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 /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
@ -855,6 +855,11 @@ struct plugin_api {
#endif #endif
unsigned (*crc_32)(const void *src, unsigned len, unsigned crc32); unsigned (*crc_32)(const void *src, unsigned len, unsigned crc32);
int (*open_utf8)(const char* pathname, int flags); 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 */ /* plugin header */

View file

@ -272,8 +272,11 @@ static const char * get_props(int selected_item, void* data,
enum plugin_status plugin_start(const void* parameter) enum plugin_status plugin_start(const void* parameter)
{ {
struct gui_synclist properties_lists; struct gui_synclist properties_lists;
#ifdef HAVE_LCD_BITMAP
int i;
#endif
int button; int button;
bool quit = false; bool quit = false, usb = false;
char file[MAX_PATH]; char file[MAX_PATH];
if(!parameter) return PLUGIN_ERROR; if(!parameter) return PLUGIN_ERROR;
rb->strcpy(file, (const char *) parameter); rb->strcpy(file, (const char *) parameter);
@ -319,6 +322,11 @@ enum plugin_status plugin_start(const void* parameter)
return PLUGIN_OK; 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_init(&properties_lists, &get_props, file, false, 1, NULL);
rb->gui_synclist_set_title(&properties_lists, its_a_dir ? rb->gui_synclist_set_title(&properties_lists, its_a_dir ?
"Directory properties" : "Directory properties" :
@ -331,7 +339,8 @@ enum plugin_status plugin_start(const void* parameter)
while(!quit) 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)) if (rb->gui_synclist_do_button(&properties_lists,&button,LIST_WRAP_ON))
continue; continue;
switch(button) switch(button)
@ -341,9 +350,18 @@ enum plugin_status plugin_start(const void* parameter)
break; break;
default: default:
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) 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;
} }

View file

@ -58,7 +58,8 @@ enum sc_list_action_type draw_sc_list(struct gui_synclist *gui_sc)
while (true) { while (true) {
/* user input */ /* 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, if (rb->gui_synclist_do_button(gui_sc, &button,
LIST_WRAP_UNLESS_HELD)) { LIST_WRAP_UNLESS_HELD)) {
/* automatic handling of user input. /* automatic handling of user input.
@ -194,6 +195,9 @@ bool ends_with(char *string, char *suffix)
enum plugin_status plugin_start(const void* void_parameter) enum plugin_status plugin_start(const void* void_parameter)
{ {
#ifdef HAVE_LCD_BITMAP
int i;
#endif
bool leave_loop; bool leave_loop;
/* This is a viewer, so a parameter must have been specified */ /* This is a viewer, so a parameter must have been specified */
@ -222,10 +226,20 @@ enum plugin_status plugin_start(const void* void_parameter)
return PLUGIN_OK; return PLUGIN_OK;
} }
#ifdef HAVE_LCD_BITMAP
FOR_NB_SCREENS(i)
rb->viewportmanager_theme_enable(i, true, NULL);
#endif
do { do {
/* Display a menu to choose between the entries */ /* Display a menu to choose between the entries */
leave_loop = list_sc(); leave_loop = list_sc();
} while (!leave_loop); } 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; return usb_connected ? PLUGIN_USB_CONNECTED : PLUGIN_OK;
} }