the menu and list now accepts a parent viewport to draw in (and the menu can be told to not show status/button bars). This lays the groundwork to fix colour problems with plugin menus (see star.c for an example.) This hopefully fixes some button bar issues as well as theme problems.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16812 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2008-03-26 03:35:24 +00:00
parent af395f4db6
commit 5ca1539969
44 changed files with 202 additions and 111 deletions

View File

@ -664,7 +664,7 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu
bookmarks->start = 0;
bookmarks->show_playlist_name
= strcmp(bookmark_file_name, RECENT_BOOKMARK_FILE) == 0;
gui_synclist_init(&list, &get_bookmark_info, (void*) bookmarks, false, 2);
gui_synclist_init(&list, &get_bookmark_info, (void*) bookmarks, false, 2, NULL);
gui_synclist_set_title(&list, str(LANG_BOOKMARK_SELECT_BOOKMARK),
Icon_Bookmark);
gui_syncstatusbar_draw(&statusbars, true);
@ -738,7 +738,7 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu
{
ACTION_STD_OK, ACTION_BMS_DELETE
};
int selection = do_menu(&menu_items, NULL);
int selection = do_menu(&menu_items, NULL, NULL, false);
refresh = true;

View File

@ -292,7 +292,7 @@ void browse_cuesheet(struct cuesheet *cue)
struct mp3entry *id3 = audio_current_track();
snprintf(title, MAX_PATH, "%s: %s", cue->performer, cue->title);
gui_synclist_init(&lists, list_get_name_cb, cue, false, 2);
gui_synclist_init(&lists, list_get_name_cb, cue, false, 2, NULL);
gui_synclist_set_nb_items(&lists, 2*cue->track_count);
gui_synclist_set_title(&lists, title, 0);

View File

@ -396,7 +396,7 @@ bool enc_config_menu(struct encoder_config *cfg)
{
menu_callback_data.cfg = &cfg;
menu_callback_data.global = false;
return do_menu(enc_data[cfg->rec_format].menu, NULL)
return do_menu(enc_data[cfg->rec_format].menu, NULL, NULL, false)
== MENU_ATTACHED_USB;
}
else
@ -454,7 +454,7 @@ bool enc_global_config_menu(void)
{
menu_callback_data.cfg = &cfg;
menu_callback_data.global = true;
return do_menu(enc_data[cfg.rec_format].menu, NULL)
return do_menu(enc_data[cfg.rec_format].menu, NULL, NULL, false)
== MENU_ATTACHED_USB;
}
else

View File

@ -107,12 +107,14 @@ bool list_display_title(struct gui_synclist *list, struct viewport *vp)
* - data : extra data passed to the list callback
* - scroll_all :
* - selected_size :
* - parent : the parent viewports to use. NULL means the full screen minus
* statusbar if enabled. NOTE: new screens should NOT set this to NULL.
*/
void gui_synclist_init(struct gui_synclist * gui_list,
list_get_name callback_get_item_name,
void * data,
bool scroll_all,
int selected_size
int selected_size, struct viewport list_parent[NB_SCREENS]
)
{
int i;
@ -128,7 +130,18 @@ void gui_synclist_init(struct gui_synclist * gui_list,
#ifdef HAVE_LCD_BITMAP
gui_list->offset_position[i] = 0;
#endif
gui_list->parent[i] = &parent[i];
if (list_parent)
gui_list->parent[i] = &list_parent[i];
else
{
gui_list->parent[i] = &parent[i];
gui_list->parent[i]->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
gui_list->parent[i]->height = screens[i].height - gui_list->parent[i]->y;
#ifdef HAS_BUTTONBAR
if (screens[i].has_buttonbar)
gui_list->parent[i]->height -= BUTTONBAR_HEIGHT;
#endif
}
}
gui_list->limit_scroll = false;
gui_list->data=data;
@ -811,7 +824,7 @@ bool simplelist_show_list(struct simplelist_info *info)
else
getname = simplelist_static_getname;
gui_synclist_init(&lists, getname, info->callback_data,
info->scroll_all, info->selection_size);
info->scroll_all, info->selection_size, NULL);
if (info->title)
gui_synclist_set_title(&lists, info->title, NOICON);
if (info->get_icon)

View File

@ -142,7 +142,8 @@ extern void gui_synclist_init(
list_get_name callback_get_item_name,
void * data,
bool scroll_all,
int selected_size
int selected_size,
struct viewport parent[NB_SCREENS] /* NOTE: new screens should NOT set this to NULL */
);
extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items);
extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback);

View File

@ -373,7 +373,7 @@ bool option_screen(struct settings_list *setting,
}
else return false; /* only int/bools can go here */
gui_synclist_init(&lists, value_setting_get_name_cb,
(void*)setting, false, 1);
(void*)setting, false, 1, NULL);
if (setting->lang_id == -1)
title = (char*)setting->cfg_vals;
else
@ -460,6 +460,7 @@ bool option_screen(struct settings_list *setting,
gui_synclist_draw(&lists);
/* talk the item */
gui_synclist_speak_item(&lists);
gui_syncstatusbar_draw(&statusbars, false);
while (!done)
{
if (list_do_action(CONTEXT_LIST, TIMEOUT_BLOCK,

View File

@ -45,15 +45,13 @@ int viewport_get_nb_lines(struct viewport *vp)
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
{
vp->xmargin = 0;
vp->ymargin = 0;
vp->x = 0;
vp->width = screens[screen].width;
vp->y = global_settings.statusbar?STATUSBAR_HEIGHT:0;
vp->height = screens[screen].height - vp->y
#ifdef HAS_BUTTONBAR
- (screens[screen].has_buttonbar?BUTTONBAR_HEIGHT:0)
#endif
;
vp->height = screens[screen].height - vp->y;
#ifdef HAVE_LCD_BITMAP
vp->drawmode = DRMODE_SOLID;
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */

View File

@ -21,9 +21,6 @@
#include "config.h"
#include "lcd.h"
#include "font.h"
#include "sprintf.h"
#include "string.h"
#include "settings.h"
#include "kernel.h"
#include "system.h"
#include "misc.h"

View File

@ -50,6 +50,7 @@
#include "bookmark.h"
#include "gwps-common.h" /* for fade() */
#include "audio.h"
#include "viewport.h"
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
@ -164,7 +165,8 @@ static int menu_get_icon(int selected_item, void * data)
#endif
static void init_menu_lists(const struct menu_item_ex *menu,
struct gui_synclist *lists, int selected, bool callback)
struct gui_synclist *lists, int selected, bool callback,
struct viewport parent[NB_SCREENS])
{
int i, count = MENU_GET_COUNT(menu->flags);
int type = (menu->flags&MENU_TYPE_MASK);
@ -197,7 +199,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
}
current_submenus_menu = (struct menu_item_ex *)menu;
gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1);
gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1, parent);
#ifdef HAVE_LCD_BITMAP
if (menu->callback_and_desc->icon_id == Icon_NOICON)
icon = Icon_Submenu_Entered;
@ -275,6 +277,29 @@ static int talk_menu_item(int selected_item, void *data)
}
return 0;
}
/* this is used to reload the default menu viewports when the
theme changes. nothing happens if the menu is using a supplied parent vp */
void init_default_menu_viewports(struct viewport parent[NB_SCREENS], bool hide_bars)
{
int i;
FOR_NB_SCREENS(i)
{
viewport_set_defaults(&parent[i], i);
/* viewport_set_defaults() fixes the vp for the bars, so resize */
if (hide_bars)
{
if (global_settings.statusbar)
{
parent[i].y -= STATUSBAR_HEIGHT;
parent[i].height += STATUSBAR_HEIGHT;
}
}
}
#ifdef HAS_BUTTONBAR
if (!hide_bars)
parent[0].height -= BUTTONBAR_HEIGHT;
#endif
}
bool do_setting_from_menu(const struct menu_item_ex *temp)
{
@ -318,42 +343,71 @@ bool do_setting_from_menu(const struct menu_item_ex *temp)
}
/* display a menu */
int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
struct viewport parent[NB_SCREENS], bool hide_bars)
{
int selected = start_selected? *start_selected : 0;
int action;
struct gui_synclist lists;
const struct menu_item_ex *temp, *menu;
int ret = 0;
int ret = 0, i;
bool redraw_lists;
#ifdef HAS_BUTTONBAR
struct gui_buttonbar buttonbar;
#endif
const struct menu_item_ex *menu_stack[MAX_MENUS];
int menu_stack_selected_item[MAX_MENUS];
int stack_top = 0;
bool in_stringlist, done = false;
struct viewport *vps, menu_vp[NB_SCREENS]; /* menu_vp will hopefully be phased out */
#ifdef HAS_BUTTONBAR
struct gui_buttonbar buttonbar;
gui_buttonbar_init(&buttonbar);
gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
gui_buttonbar_set(&buttonbar, "<<<", "", "");
#endif
menu_callback_type menu_callback = NULL;
if (start_menu == NULL)
menu = &main_menu_;
else menu = start_menu;
#ifdef HAS_BUTTONBAR
gui_buttonbar_init(&buttonbar);
gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
gui_buttonbar_set(&buttonbar, "<<<", "", "");
gui_buttonbar_draw(&buttonbar);
#endif
init_menu_lists(menu,&lists,selected,true);
if (parent)
{
vps = parent;
/* if hide_bars == true we assume the viewport is correctly sized */
}
else
{
vps = menu_vp;
init_default_menu_viewports(vps, hide_bars);
}
FOR_NB_SCREENS(i)
{
screens[i].set_viewport(&vps[i]);
screens[i].clear_viewport();
screens[i].set_viewport(NULL);
}
init_menu_lists(menu, &lists, selected, true, vps);
in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID);
/* load the callback, and only reload it if menu changes */
get_menu_callback(menu, &menu_callback);
#ifdef HAS_BUTTONBAR
if (!hide_bars)
{
gui_buttonbar_set(&buttonbar, "<<<", "", "");
gui_buttonbar_draw(&buttonbar);
}
#endif
while (!done)
{
redraw_lists = false;
gui_syncstatusbar_draw(&statusbars, true);
if (!hide_bars)
{
gui_syncstatusbar_draw(&statusbars, true);
}
action = get_action(CONTEXT_MAINMENU,
list_do_action_timeout(&lists, HZ));
/* HZ so the status bar redraws corectly */
@ -430,7 +484,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
done = true;
else
init_menu_lists(menu, &lists,
menu_stack_selected_item[stack_top], false);
menu_stack_selected_item[stack_top], false, vps);
/* new menu, so reload the callback */
get_menu_callback(menu, &menu_callback);
}
@ -444,8 +498,11 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
{
int type;
#ifdef HAS_BUTTONBAR
gui_buttonbar_unset(&buttonbar);
gui_buttonbar_draw(&buttonbar);
if (!hide_bars)
{
gui_buttonbar_unset(&buttonbar);
gui_buttonbar_draw(&buttonbar);
}
#endif
selected = get_menu_selection(gui_synclist_get_sel_pos(&lists), menu);
temp = menu->submenus[selected];
@ -471,7 +528,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
menu_stack[stack_top] = menu;
menu_stack_selected_item[stack_top] = selected;
stack_top++;
init_menu_lists(temp, &lists, 0, true);
init_menu_lists(temp, &lists, 0, true, vps);
redraw_lists = false; /* above does the redraw */
menu = temp;
}
@ -491,8 +548,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
if (temp->flags&MENU_HAS_DESC &&
temp->callback_and_desc->desc == ID2P(LANG_LANGUAGE))
{
init_menu_lists(menu, &lists, selected, true);
init_menu_lists(menu, &lists, selected, true, vps);
}
init_default_menu_viewports(menu_vp, hide_bars);
if (temp->flags&MENU_FUNC_CHECK_RETVAL)
{
@ -509,7 +567,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
{
if (do_setting_from_menu(temp))
{
init_menu_lists(menu, &lists, selected, true);
init_default_menu_viewports(menu_vp, hide_bars);
init_menu_lists(menu, &lists, selected, true,vps);
redraw_lists = false; /* above does the redraw */
}
break;
@ -526,7 +585,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
menu_stack_selected_item[stack_top] = selected;
stack_top++;
menu = temp;
init_menu_lists(menu,&lists,0,false);
init_menu_lists(menu,&lists,0,false, vps);
redraw_lists = false; /* above does the redraw */
in_stringlist = true;
}
@ -542,7 +601,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
menu_callback(ACTION_EXIT_MENUITEM,temp);
}
if (current_submenus_menu != menu)
init_menu_lists(menu,&lists,selected,true);
init_menu_lists(menu,&lists,selected,true,vps);
/* callback was changed, so reload the menu's callback */
get_menu_callback(menu, &menu_callback);
if ((menu->flags&MENU_EXITAFTERTHISMENU) &&
@ -552,8 +611,11 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
break;
}
#ifdef HAS_BUTTONBAR
gui_buttonbar_set(&buttonbar, "<<<", "", "");
gui_buttonbar_draw(&buttonbar);
if (!hide_bars)
{
gui_buttonbar_set(&buttonbar, "<<<", "", "");
gui_buttonbar_draw(&buttonbar);
}
#endif
}
else if(default_event_handler(action) == SYS_USB_CONNECTED)
@ -575,7 +637,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
if (stack_top > 0)
{
menu = menu_stack[0];
init_menu_lists(menu,&lists,menu_stack_selected_item[0],true);
init_menu_lists(menu,&lists,menu_stack_selected_item[0],true, vps);
}
*start_selected = get_menu_selection(
gui_synclist_get_sel_pos(&lists), menu);

View File

@ -117,7 +117,8 @@ bool do_setting_from_menu(const struct menu_item_ex *temp);
This is always set, even if the menu was cancelled.
If NULL it is ignored and the firs item starts selected
*/
int do_menu(const struct menu_item_ex *menu, int *start_selected);
int do_menu(const struct menu_item_ex *menu, int *start_selected,
struct viewport parent[NB_SCREENS], bool hide_bars);
/* In all the following macros the argument names are as follows:
- name: The name for the variable (so it can be used in a MAKE_MENU()

View File

@ -199,7 +199,7 @@ int do_center_band_menu(void* param)
menu.flags = MT_MENU|(3<<MENU_COUNT_SHIFT)|MENU_HAS_DESC;
menu.submenus = band_items[band-1];
menu.callback_and_desc = &cb_and_desc;
do_menu(&menu, NULL);
do_menu(&menu, NULL, NULL, false);
return 0;
}
MAKE_MENU(band_0_menu, ID2P(LANG_EQUALIZER_BAND_LOW_SHELF), NULL,

View File

@ -901,7 +901,7 @@ bool recording_menu(bool no_source)
{
bool retval;
no_source_in_menu = no_source;
retval = do_menu(&recording_settings_menu, NULL) == MENU_ATTACHED_USB;
retval = do_menu(&recording_settings_menu, NULL, NULL, false) == MENU_ATTACHED_USB;
no_source_in_menu = false; /* always fall back to the default */
return retval;
};

View File

@ -1197,7 +1197,7 @@ int onplay(char* file, int attr, int from)
menu = &wps_onplay_menu;
else
menu = &tree_onplay_menu;
switch (do_menu(menu, NULL))
switch (do_menu(menu, NULL, NULL, false))
{
case GO_TO_WPS:
return ONPLAY_START_PLAY;

View File

@ -234,7 +234,7 @@ static int display_playlists(char* playlist, bool view)
playlist = temp_buf;
gui_synclist_init(&playlist_lists, playlist_callback_name, playlists,
false, 1);
false, 1, NULL);
gui_synclist_set_nb_items(&playlist_lists, num_playlists);
gui_synclist_draw(&playlist_lists);

View File

@ -438,7 +438,7 @@ static int onplay_menu(int index)
ID2P(LANG_CATALOG_ADD_TO), ID2P(LANG_CATALOG_ADD_TO_NEW));
bool current = (current_track->index == viewer.current_playing_track);
result = do_menu(&menu_items, NULL);
result = do_menu(&menu_items, NULL, NULL, false);
if (result == MENU_ATTACHED_USB)
{
ret = -1;
@ -505,7 +505,7 @@ MAKE_MENU(viewer_settings_menu, ID2P(LANG_PLAYLISTVIEWER_SETTINGS),
&show_icons, &show_indices, &track_display, &save_playlist_item);
static bool viewer_menu(void)
{
return do_menu(&viewer_settings_menu, NULL) == MENU_ATTACHED_USB;
return do_menu(&viewer_settings_menu, NULL, NULL, false) == MENU_ATTACHED_USB;
}
/* Save playlist to disk */
@ -589,7 +589,8 @@ bool playlist_viewer_ex(char* filename)
if (!playlist_viewer_init(&viewer, filename, false))
goto exit;
gui_synclist_init(&playlist_lists, playlist_callback_name, &viewer, false, 1);
gui_synclist_init(&playlist_lists, playlist_callback_name,
&viewer, false, 1, NULL);
gui_synclist_set_icon_callback(&playlist_lists,
global_settings.playlist_viewer_icons?
&playlist_callback_icons:NULL);
@ -798,7 +799,7 @@ bool search_playlist(void)
}
backlight_on();
gui_synclist_init(&playlist_lists, playlist_search_callback_name,
found_indicies, false, 1);
found_indicies, false, 1, NULL);
gui_synclist_set_icon_callback(&playlist_lists, NULL);
gui_synclist_set_nb_items(&playlist_lists, found_indicies_count);
gui_synclist_select_item(&playlist_lists, 0);

View File

@ -193,7 +193,8 @@ static const struct plugin_api rockbox_api = {
lcd_remote_bitmap_part,
lcd_remote_bitmap,
#endif
viewport_set_defaults,
/* list */
gui_synclist_init,
gui_synclist_set_nb_items,

View File

@ -80,6 +80,7 @@
#include "color_picker.h"
#include "buffering.h"
#include "tagcache.h"
#include "viewport.h"
#ifdef HAVE_ALBUMART
#include "albumart.h"
@ -119,12 +120,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 102
#define PLUGIN_API_VERSION 103
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 102
#define PLUGIN_MIN_API_VERSION 103
/* plugin return codes */
enum plugin_status {
@ -285,10 +286,12 @@ struct plugin_api {
void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, int width,
int height);
#endif
void (*viewport_set_defaults)(struct viewport *vp, enum screen_type screen);
/* list */
void (*gui_synclist_init)(struct gui_synclist * lists,
list_get_name callback_get_item_name,void * data,
bool scroll_all,int selected_size);
bool scroll_all,int selected_size,
struct viewport parent[NB_SCREENS]);
void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items);
void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback);
int (*gui_synclist_get_nb_items)(struct gui_synclist * lists);
@ -555,7 +558,8 @@ struct plugin_api {
#endif
/* menu */
int (*do_menu)(const struct menu_item_ex *menu, int *start_selected);
int (*do_menu)(const struct menu_item_ex *menu, int *start_selected,
struct viewport parent[NB_SCREENS], bool hide_bars);
/* scroll bar */
struct gui_syncstatusbar *statusbars;

View File

@ -393,7 +393,7 @@ static int cb_menu_viewer(void)
while(!menu_quit)
{
switch(rb->do_menu(&menu, &selection))
switch(rb->do_menu(&menu, &selection, NULL, false))
{
case 0:
menu_quit = true;
@ -595,7 +595,7 @@ static int cb_menu(void)
while(!menu_quit)
{
switch(rb->do_menu(&menu, &selection))
switch(rb->do_menu(&menu, &selection, NULL, false))
{
case 0:
menu_quit = true;

View File

@ -628,7 +628,7 @@ struct pgn_game_node* pgn_show_game_list(struct plugin_api* api,
}
rb->gui_synclist_init(&games_list, &get_game_text, first_game, false, 1);
rb->gui_synclist_init(&games_list, &get_game_text, first_game, false, 1, NULL);
rb->gui_synclist_set_title(&games_list, "Games", NOICON);
rb->gui_synclist_set_icon_callback(&games_list, NULL);
rb->gui_synclist_set_nb_items(&games_list, i);

View File

@ -684,7 +684,7 @@ static int chopMenu(int menunum)
rb->lcd_clear_display();
while (!menu_quit) {
switch(rb->do_menu(&menu, &result))
switch(rb->do_menu(&menu, &result, NULL, false))
{
case 0: /* Start New Game */
menu_quit=true;

View File

@ -57,7 +57,7 @@ static const struct opt_items hour_format_text[] = {
bool menu_mode_selector(void){
MENUITEM_STRINGLIST(menu,"Mode Selector",NULL, "Analog",
"Digital", "Binary");
if(rb->do_menu(&menu, &clock_settings.mode) >=0)
if(rb->do_menu(&menu, &clock_settings.mode, NULL, false) >=0)
return(true);
return(false);
}
@ -73,7 +73,7 @@ void menu_analog_settings(void)
"Show Second Hand","Show Border");
while(result>=0){
result=rb->do_menu(&menu, &selection);
result=rb->do_menu(&menu, &selection, NULL, false);
switch(result){
case 0:
rb->set_option("Show Date", &clock_settings.analog.show_date,
@ -103,7 +103,7 @@ void menu_digital_settings(void){
"Blinking Colon");
while(result>=0){
result=rb->do_menu(&menu, &selection);
result=rb->do_menu(&menu, &selection, NULL, false);
switch(result){
case 0:
rb->set_option("Show Seconds",
@ -148,7 +148,7 @@ void menu_general_settings(void){
"Idle Poweroff (temporary)");
while(result>=0){
result=rb->do_menu(&menu, &selection);
result=rb->do_menu(&menu, &selection, NULL, false);
switch(result){
case 0:
rb->set_option("Hour format",
@ -211,7 +211,7 @@ bool main_menu(void){
"Mode Settings","General Settings","Quit");
while(!done){
switch(rb->do_menu(&menu, &selection)){
switch(rb->do_menu(&menu, &selection, NULL, false)){
case 0:
done = true;
break;

View File

@ -177,7 +177,7 @@ bool dice_menu(struct dices * dice) {
while (!menu_quit) {
switch(rb->do_menu(&menu, &selection)){
switch(rb->do_menu(&menu, &selection, NULL, false)){
case 0:
menu_quit = true;
result = true;

View File

@ -369,7 +369,7 @@ int tidy_lcd_menu(void)
while (!menu_quit)
{
switch(rb->do_menu(&menu, &selection))
switch(rb->do_menu(&menu, &selection, NULL, false))
{
case 0:

View File

@ -74,7 +74,7 @@ int menu_init(struct plugin_api *api, const struct menu_item* mitems,
return -1;
menus[menu].items = (struct menu_item*)mitems; /* de-const */
rb->gui_synclist_init(&(menus[menu].synclist),
&menu_get_itemname, &menus[menu], false, 1);
&menu_get_itemname, &menus[menu], false, 1, NULL);
rb->gui_synclist_set_icon_callback(&(menus[menu].synclist), NULL);
rb->gui_synclist_set_nb_items(&(menus[menu].synclist), count);
menus[menu].callback = callback;

View File

@ -111,5 +111,5 @@ void playback_control_init(struct plugin_api* newapi)
bool playback_control(struct plugin_api* newapi)
{
api = newapi;
return api->do_menu(&playback_control_menu, NULL) == MENU_ATTACHED_USB;
return api->do_menu(&playback_control_menu, NULL, NULL, false) == MENU_ATTACHED_USB;
}

View File

@ -498,7 +498,7 @@ enum minesweeper_status menu( void )
while( !menu_quit )
{
switch( rb->do_menu( &menu, &selection ) )
switch( rb->do_menu( &menu, &selection, NULL, false ) )
{
case 0:
result = MINESWEEPER_WIN; /* start playing */

View File

@ -1541,7 +1541,7 @@ int settings_menu(void) {
"Rebuild cache");
do {
selection=rb->do_menu(&settings_menu,&selection);
selection=rb->do_menu(&settings_menu,&selection, NULL, false);
switch(selection) {
case 0:
rb->set_bool("Show FPS", &show_fps);
@ -1604,7 +1604,7 @@ int main_menu(void)
"Settings", "Return", "Quit");
while (1) {
switch (rb->do_menu(&main_menu,&selection)) {
switch (rb->do_menu(&main_menu,&selection, NULL, false)) {
case 0:
result = settings_menu();
if ( result != 0 ) return result;

View File

@ -305,7 +305,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
prev_show_statusbar = rb->global_settings->statusbar;
rb->global_settings->statusbar = false;
rb->gui_synclist_init(&properties_lists, &get_props, file, false, 1);
rb->gui_synclist_init(&properties_lists, &get_props, file, false, 1, NULL);
rb->gui_synclist_set_title(&properties_lists, its_a_dir ?
"Directory properties" :
"File properties", NOICON);

View File

@ -278,7 +278,7 @@ void edit_list(void)
list = (struct file_format *)buffer;
dirs_count = list->count;
rb->gui_synclist_init(&lists,list_get_name_cb,0, false, 1);
rb->gui_synclist_init(&lists,list_get_name_cb,0, false, 1, NULL);
rb->gui_synclist_set_icon_callback(&lists,NULL);
rb->gui_synclist_set_nb_items(&lists,list->count);
rb->gui_synclist_limit_scroll(&lists,true);

View File

@ -117,7 +117,7 @@ bool list_sc(bool is_editable)
/* Setup the GUI list object, draw it to the screen,
* and then handle the user input to it */
rb->gui_synclist_init(&gui_sc, &build_sc_list, &sc_file, false, 1);
rb->gui_synclist_init(&gui_sc, &build_sc_list, &sc_file, false, 1, NULL);
rb->gui_synclist_set_title(&gui_sc,
(is_editable?"Shortcuts (editable)":"Shortcuts (sealed)"), NOICON);
rb->gui_synclist_set_nb_items(&gui_sc, sc_file.entry_cnt);

View File

@ -396,7 +396,7 @@ void game_init(void) {
"Quit");
while (!menu_quit) {
switch(rb->do_menu(&menu, &selection))
switch(rb->do_menu(&menu, &selection, NULL, false))
{
case 0:
menu_quit = true; /* start playing */

View File

@ -1173,7 +1173,7 @@ static int sokoban_menu(void)
do {
menu_quit = true;
selection = rb->do_menu(&menu, &start_selected);
selection = rb->do_menu(&menu, &start_selected, NULL, false);
switch (selection) {
case 0: /* Resume */

View File

@ -951,16 +951,28 @@ static int star_menu(void)
{
int selection, level=1;
bool menu_quit = false;
struct viewport vp[NB_SCREENS];
/* get the size of char */
rb->lcd_getstringsize("a", &char_width, &char_height);
MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Play","Choose Level",
"Information","Keys","Quit");
FOR_NB_SCREENS(selection)
{
rb->viewport_set_defaults(&vp[selection], selection);
/* we are hiding the statusbar so fix the height also */
vp->y = 0; vp->height = rb->screens[selection]->height;
#if LCD_DEPTH > 1
if (rb->screens[selection]->depth > 1)
{
vp->bg_pattern = LCD_BLACK;
vp->fg_pattern = LCD_WHITE;
}
#endif
}
while(!menu_quit)
{
switch(rb->do_menu(&menu, &selection))
switch(rb->do_menu(&menu, &selection, vp, true))
{
case 0:
menu_quit = true;

View File

@ -493,7 +493,7 @@ int settings_menu_function(void) {
"Human starting farms","Human starting factories",
"Starting cash","Starting food","Moves per turn");
settings_menu:
selection=rb->do_menu(&settings_menu,&selection);
selection=rb->do_menu(&settings_menu,&selection, NULL, false);
switch(selection) {
case 0:
rb->set_int("Computer starting farms", "", UNIT_INT,
@ -557,7 +557,7 @@ int do_help(void) {
"Each tile has a strength, calculated by the ownership",
"of adjacent tiles, and the type and number of troops",
"on them.");
rb->do_menu(&help_menu,&selection);
rb->do_menu(&help_menu,&selection, NULL, false);
switch(selection) {
case MENU_ATTACHED_USB:
return PLUGIN_USB_CONNECTED;
@ -573,7 +573,7 @@ int menu(void) {
"Play Super Domination","Settings","Help","Quit");
while(1) {
selection=rb->do_menu(&main_menu,&selection);
selection=rb->do_menu(&main_menu,&selection, NULL, false);
switch(selection) {
case 0:
return 0; /* start playing */
@ -651,7 +651,7 @@ int ingame_menu(void) {
MENUITEM_STRINGLIST(ingame_menu,"Super Domination Menu",NULL,
"Return to game","Save Game", "Quit");
selection=rb->do_menu(&ingame_menu,&selection);
selection=rb->do_menu(&ingame_menu,&selection, NULL, false);
switch(selection) {
case 0:
return 0;
@ -864,7 +864,7 @@ int buy_resources_menu(void) {
"Finish buying", "Game menu");
resources_menu:
selection=rb->do_menu(&res_menu,&selection);
selection=rb->do_menu(&res_menu,&selection, NULL, false);
switch(selection) {
case 0:
nummen = 0;
@ -1059,7 +1059,7 @@ int move_unit(void) {
MENUITEM_STRINGLIST(move_unit_menu, "Move unit", NULL, "Move men",
"Move tank", "Move plane");
selection=rb->do_menu(&move_unit_menu,&selection);
selection=rb->do_menu(&move_unit_menu,&selection, NULL, false);
switch(selection) {
case 0:
rb->splash(HZ, "Select where to move troops from");
@ -1173,7 +1173,7 @@ int movement_menu(void) {
"Check map", "Finish moving", "Game menu");
while(!menu_quit) {
selection=rb->do_menu(&move_menu,&selection);
selection=rb->do_menu(&move_menu,&selection, NULL, false);
switch(selection) {
case 0:
if(humanres.moves) {
@ -1281,7 +1281,7 @@ int production_menu(void) {
"Withdraw money", "Finish turn", "Game menu");
while(1) {
selection=rb->do_menu(&prod_menu,&selection);
selection=rb->do_menu(&prod_menu,&selection, NULL, false);
switch(selection) {
case 0:
tempmenu = buy_resources_menu();
@ -1523,7 +1523,7 @@ int war_menu(void) {
humanres.moves = superdom_settings.movesperturn;
while(humanres.moves) {
selection=rb->do_menu(&wartime_menu,&selection);
selection=rb->do_menu(&wartime_menu,&selection, NULL, false);
switch(selection) {
case 0:
if(select_square() == PLUGIN_USB_CONNECTED)

View File

@ -715,7 +715,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_clear_display();
result=rb->do_menu(&menu,&selection);
result=rb->do_menu(&menu,&selection, NULL, false);
scandir = 0;

View File

@ -202,7 +202,7 @@ void save_changes(int overwrite)
void setup_lists(struct gui_synclist *lists, int sel)
{
rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1);
rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, NULL);
rb->gui_synclist_set_icon_callback(lists,NULL);
rb->gui_synclist_set_nb_items(lists,line_count);
rb->gui_synclist_limit_scroll(lists,true);
@ -222,7 +222,7 @@ int do_item_menu(int cur_sel, char* copy_buffer)
"Insert Above", "Insert Below",
"Concat To Above", "Save");
switch (rb->do_menu(&menu, NULL))
switch (rb->do_menu(&menu, NULL, NULL, false))
{
case 0: /* cut */
rb->strcpy(copy_buffer,&buffer[do_action(ACTION_GET,0,cur_sel)]);
@ -400,7 +400,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
MENUITEM_STRINGLIST(menu, "Edit What?", NULL,
"Extension", "Color",);
switch (rb->do_menu(&menu, NULL))
switch (rb->do_menu(&menu, NULL, NULL, false))
{
case 0:
edit_text = true;
@ -468,7 +468,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
"Show Playback Menu", "Save Changes",
"Save As...", "Save and Exit",
"Ignore Changes and Exit");
switch (rb->do_menu(&menu, NULL))
switch (rb->do_menu(&menu, NULL, NULL, false))
{
case 0:
break;

View File

@ -401,7 +401,7 @@ static bool vu_meter_menu(void)
};
while (!menu_quit) {
switch(rb->do_menu(&menu, &selection))
switch(rb->do_menu(&menu, &selection, NULL, false))
{
case 0:
rb->set_option("Meter Type", &vumeter_settings.meter_type, INT,

View File

@ -3716,7 +3716,7 @@ static int recording_menu(void)
while (!done)
{
switch (rb->do_menu(&menu, &menupos))
switch (rb->do_menu(&menu, &menupos, NULL, false))
{
case 0: /* Set sample rate */
rb->set_option("Sample rate", &reccfg.samplerate, INT, freqs, 9, NULL);

View File

@ -2599,7 +2599,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->button_clear_queue();
while (!menu_quit) {
switch(rb->do_menu(&menu, &result))
switch(rb->do_menu(&menu, &result, NULL, false))
{
case 0:
rb->lcd_setfont(FONT_SYSFIXED);

View File

@ -851,7 +851,7 @@ static int game_menu (void)
rb->lcd_set_background(LCD_WHITE);
#endif
for (;;) {
rb->do_menu(&menu,&selection);
rb->do_menu(&menu,&selection, NULL, false);
if (selection==1)
rb->set_int ("Speed", "", UNIT_INT, &speed, NULL, 1, 1, 10, NULL);
else if (selection==2)

View File

@ -1331,7 +1331,7 @@ static int handle_radio_presets(void)
str(LANG_FM_BUTTONBAR_ACTION));
gui_buttonbar_draw(&buttonbar);
#endif
gui_synclist_init(&lists, presets_get_name, NULL, false, 1);
gui_synclist_init(&lists, presets_get_name, NULL, false, 1, NULL);
gui_synclist_set_title(&lists, str(LANG_PRESET), NOICON);
gui_synclist_set_icon_callback(&lists, NULL);
if(global_settings.talk_file)
@ -1364,7 +1364,7 @@ static int handle_radio_presets(void)
case ACTION_F3:
case ACTION_STD_CONTEXT:
selected_preset = gui_synclist_get_sel_pos(&lists);
do_menu(&handle_radio_preset_menu, NULL);
do_menu(&handle_radio_preset_menu, NULL, NULL, false);
gui_synclist_speak_item(&lists);
break;
default:
@ -1583,7 +1583,7 @@ MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL,
/* main menu of the radio screen */
static bool radio_menu(void)
{
return do_menu(&radio_settings_menu, NULL) == MENU_ATTACHED_USB;
return do_menu(&radio_settings_menu, NULL, NULL, false) == MENU_ATTACHED_USB;
}
#endif

View File

@ -221,7 +221,7 @@ static int browser(void* param)
static int menu(void* param)
{
(void)param;
return do_menu(NULL, 0);
return do_menu(NULL, 0, NULL, false);
}
#ifdef HAVE_RECORDING
@ -292,7 +292,7 @@ static int plugins_menu(void* param)
int selection = 0, current = 0;
while (retval == GO_TO_PREVIOUS)
{
selection = do_menu(&plugins_menu_items, &current);
selection = do_menu(&plugins_menu_items, &current, NULL, false);
switch (selection)
{
case 0:
@ -483,7 +483,7 @@ static int load_context_screen(int selection)
}
if (context_menu)
return do_menu(context_menu, NULL);
return do_menu(context_menu, NULL, NULL, false);
else
return GO_TO_PREVIOUS;
}
@ -540,7 +540,7 @@ void root_menu(void)
case GO_TO_ROOT:
if (last_screen != GO_TO_ROOT)
selected = get_selection(last_screen);
next_screen = do_menu(&root_menu_, &selected);
next_screen = do_menu(&root_menu_, &selected, NULL, false);
if (next_screen != GO_TO_PREVIOUS)
last_screen = GO_TO_ROOT;
break;

View File

@ -1223,7 +1223,7 @@ bool browse_id3(void)
struct mp3entry* id3 = audio_current_track();
int key;
gui_synclist_init(&id3_lists, &id3_get_info, id3, true, 2);
gui_synclist_init(&id3_lists, &id3_get_info, id3, true, 2, NULL);
gui_synclist_set_nb_items(&id3_lists,
sizeof(id3_headers)/sizeof(id3_headers[0])*2);
gui_synclist_draw(&id3_lists);
@ -1275,7 +1275,7 @@ bool view_runtime(void)
struct gui_synclist lists;
int action;
gui_synclist_init(&lists, runtime_get_data, NULL, false, 2);
gui_synclist_init(&lists, runtime_get_data, NULL, false, 2, NULL);
#if !defined(HAVE_LCD_CHARCELLS)
gui_synclist_set_title(&lists, str(LANG_RUNNING_TIME), NOICON);
#else

View File

@ -307,7 +307,7 @@ void tree_gui_init(void)
/* since archos only have one screen, no need to create more than that */
gui_buttonbar_set_display(&tree_buttonbar, &(screens[SCREEN_MAIN]) );
#endif
gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1);
gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL);
gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb);
gui_synclist_set_icon_callback(&tree_lists, &tree_get_fileicon);
#ifdef HAVE_LCD_COLOR