1
0
Fork 0
forked from len0rd/rockbox

Fix the text for settings which have a different title than what is shown in the menu (i.e scroll options)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13962 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-07-23 05:40:45 +00:00
parent 8584a6bb5d
commit fe2b376060
5 changed files with 24 additions and 17 deletions

View file

@ -276,7 +276,8 @@ static void bool_funcwrapper(int value)
boolfunction(false); boolfunction(false);
} }
bool option_screen(struct settings_list *setting, bool use_temp_var) bool option_screen(struct settings_list *setting,
bool use_temp_var, unsigned char* option_title)
{ {
int action; int action;
bool done = false; bool done = false;
@ -286,7 +287,7 @@ bool option_screen(struct settings_list *setting, bool use_temp_var)
bool allow_wrap = ((int*)setting->setting != &global_settings.volume); bool allow_wrap = ((int*)setting->setting != &global_settings.volume);
int var_type = setting->flags&F_T_MASK; int var_type = setting->flags&F_T_MASK;
void (*function)(int) = NULL; void (*function)(int) = NULL;
char *title;
if (var_type == F_T_INT || var_type == F_T_UINT) if (var_type == F_T_INT || var_type == F_T_UINT)
{ {
variable = use_temp_var ? &temp_var: (int*)setting->setting; variable = use_temp_var ? &temp_var: (int*)setting->setting;
@ -303,11 +304,11 @@ bool option_screen(struct settings_list *setting, bool use_temp_var)
gui_synclist_init(&lists, value_setting_get_name_cb, gui_synclist_init(&lists, value_setting_get_name_cb,
(void*)setting, false, 1); (void*)setting, false, 1);
if (setting->lang_id == -1) if (setting->lang_id == -1)
gui_synclist_set_title(&lists, title = (char*)setting->cfg_vals;
(char*)setting->cfg_vals, Icon_Questionmark);
else else
gui_synclist_set_title(&lists, title = P2STR(option_title);
str(setting->lang_id), Icon_Questionmark);
gui_synclist_set_title(&lists, title, Icon_Questionmark);
gui_synclist_set_icon_callback(&lists, NULL); gui_synclist_set_icon_callback(&lists, NULL);
/* set the number of items and current selection */ /* set the number of items and current selection */
@ -466,7 +467,7 @@ bool set_option(const char* string, void* variable, enum optiontype type,
data.desc = (void*)strings; /* shutup gcc... */ data.desc = (void*)strings; /* shutup gcc... */
data.option_callback = function; data.option_callback = function;
item.choice_setting = &data; item.choice_setting = &data;
option_screen(&item, false); option_screen(&item, false, NULL);
if (type == BOOL) if (type == BOOL)
{ {
*(bool*)variable = (temp == 1? true: false); *(bool*)variable = (temp == 1? true: false);
@ -496,7 +497,7 @@ bool set_int_ex(const unsigned char* string,
item.lang_id = -1; item.lang_id = -1;
item.cfg_vals = (char*)string; item.cfg_vals = (char*)string;
item.setting = variable; item.setting = variable;
return option_screen(&item, false); return option_screen(&item, false, NULL);
} }
/* to be replaced */ /* to be replaced */

View file

@ -21,7 +21,8 @@
#define _GUI_OPTION_SELECT_H_ #define _GUI_OPTION_SELECT_H_
#include "settings.h" #include "settings.h"
bool option_screen(struct settings_list *setting, bool use_temp_var); bool option_screen(struct settings_list *setting,
bool use_temp_var, unsigned char* option_title);
struct option_select struct option_select
{ {

View file

@ -253,15 +253,19 @@ static void talk_menu_item(const struct menu_item_ex *menu,
} }
} }
#define MAX_OPTIONS 32 #define MAX_OPTIONS 32
/* returns true if the menu needs to be redrwan */
bool do_setting_from_menu(const struct menu_item_ex *temp) bool do_setting_from_menu(const struct menu_item_ex *temp)
{ {
int setting_id; int setting_id;
const struct settings_list *setting = find_setting( const struct settings_list *setting = find_setting(
temp->variable, temp->variable,
&setting_id); &setting_id);
char *title;
if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT)
title = temp->callback_and_desc->desc;
else
title = ID2P(setting->lang_id);
option_screen((struct settings_list *)setting, option_screen((struct settings_list *)setting,
setting->flags&F_TEMPVAR); setting->flags&F_TEMPVAR, title);
return false; return false;
} }

View file

@ -112,12 +112,12 @@
#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 64 #define PLUGIN_API_VERSION 65
/* 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
new function which are "waiting" at the end of the function table) */ new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 64 #define PLUGIN_MIN_API_VERSION 65
/* plugin return codes */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -499,7 +499,8 @@ struct plugin_api {
/* options */ /* options */
const struct settings_list* (*find_setting)(void* variable, int *id); const struct settings_list* (*find_setting)(void* variable, int *id);
bool (*option_screen)(struct settings_list *setting, bool use_temp_var); bool (*option_screen)(struct settings_list *setting,
bool use_temp_var, unsigned char* option_title);
bool (*set_option)(const char* string, void* variable, bool (*set_option)(const char* string, void* variable,
enum optiontype type, const struct opt_items* options, enum optiontype type, const struct opt_items* options,
int numoptions, void (*function)(int)); int numoptions, void (*function)(int));

View file

@ -61,14 +61,14 @@ static bool volume(void)
{ {
const struct settings_list* vol = const struct settings_list* vol =
api->find_setting(&api->global_settings->volume, NULL); api->find_setting(&api->global_settings->volume, NULL);
return api->option_screen((struct settings_list*)vol, false); return api->option_screen((struct settings_list*)vol, false, NULL);
} }
static bool shuffle(void) static bool shuffle(void)
{ {
const struct settings_list* shuffle = const struct settings_list* shuffle =
api->find_setting(&api->global_settings->playlist_shuffle, NULL); api->find_setting(&api->global_settings->playlist_shuffle, NULL);
return api->option_screen((struct settings_list*)shuffle, false); return api->option_screen((struct settings_list*)shuffle, false, NULL);
} }
static bool repeat_mode(void) static bool repeat_mode(void)
@ -77,7 +77,7 @@ static bool repeat_mode(void)
api->find_setting(&api->global_settings->repeat_mode, NULL); api->find_setting(&api->global_settings->repeat_mode, NULL);
int old_repeat = api->global_settings->repeat_mode; int old_repeat = api->global_settings->repeat_mode;
api->option_screen((struct settings_list*)repeat, false); api->option_screen((struct settings_list*)repeat, false, NULL);
if (old_repeat != api->global_settings->repeat_mode && if (old_repeat != api->global_settings->repeat_mode &&
(api->audio_status() & AUDIO_STATUS_PLAY)) (api->audio_status() & AUDIO_STATUS_PLAY))