Combine the settings for scrollbar on/off and its position into one with three possible values

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22425 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Alexander Levin 2009-08-19 12:36:40 +00:00
parent 3943ab0750
commit 07d0bfd101
7 changed files with 22 additions and 20 deletions

View file

@ -130,12 +130,12 @@ void list_draw(struct screen *display, struct gui_synclist *list)
vp = list_text[screen];
vp.width = SCROLLBAR_WIDTH;
list_text[screen].width -= SCROLLBAR_WIDTH;
if(!global_settings.scrollbar_position) /* left */
if(global_settings.scrollbar == SCROLLBAR_LEFT)
list_text[screen].x += SCROLLBAR_WIDTH;
vp.height = line_height *
viewport_get_nb_lines(&list_text[screen]);
vp.x = parent->x;
if(global_settings.scrollbar_position) /* right */
if(global_settings.scrollbar == SCROLLBAR_RIGHT) /* right */
vp.x += list_text[screen].width;
display->set_viewport(&vp);
gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1,
@ -147,7 +147,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
else if (show_title)
{
/* shift everything right a bit... */
if(!global_settings.scrollbar_position) /* left */
if(global_settings.scrollbar == SCROLLBAR_LEFT)
{
list_text[screen].width -= SCROLLBAR_WIDTH;
list_text[screen].x += SCROLLBAR_WIDTH;
@ -341,13 +341,13 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
return ACTION_NONE;
}
/* Scroll bar */
else if(!global_settings.scrollbar_position) /* left */
else if(global_settings.scrollbar == SCROLLBAR_LEFT)
return gui_synclist_touchscreen_scrollbar(gui_list, y);
}
else
{
if(x>list_text[screen].x+list_text[screen].width &&
global_settings.scrollbar_position) /* right*/
global_settings.scrollbar == SCROLLBAR_RIGHT)
return gui_synclist_touchscreen_scrollbar(gui_list, y);
/* |--------------------------------------------------------|

View file

@ -321,7 +321,6 @@ static int statusbar_callback(int action,const struct menu_item_ex *this_item)
}
MENUITEM_SETTING(scrollbar_item, &global_settings.scrollbar, NULL);
MENUITEM_SETTING(scrollbar_width, &global_settings.scrollbar_width, NULL);
MENUITEM_SETTING(scrollbar_position, &global_settings.scrollbar_position, NULL);
MENUITEM_SETTING(statusbar, &global_settings.statusbar, statusbar_callback);
#ifdef HAVE_REMOTE_LCD
MENUITEM_SETTING(remote_statusbar, &global_settings.remote_statusbar, statusbar_callback);
@ -332,7 +331,7 @@ MENUITEM_SETTING(buttonbar, &global_settings.buttonbar, NULL);
MENUITEM_SETTING(volume_type, &global_settings.volume_type, NULL);
MENUITEM_SETTING(battery_display, &global_settings.battery_display, NULL);
MAKE_MENU(bars_menu, ID2P(LANG_BARS_MENU), 0, Icon_NOICON,
&scrollbar_item, &scrollbar_width, &scrollbar_position, &statusbar,
&scrollbar_item, &scrollbar_width, &statusbar,
#ifdef HAVE_REMOTE_LCD
&remote_statusbar,
#endif

View file

@ -133,12 +133,12 @@ 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 168
#define PLUGIN_API_VERSION 169
/* 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 167
#define PLUGIN_MIN_API_VERSION 169
/* plugin return codes */
enum plugin_status {

View file

@ -159,6 +159,9 @@ enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL };
/* statusbar visibility/position */
enum { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM };
/* scrollbar visibility/position */
enum { SCROLLBAR_OFF = 0, SCROLLBAR_LEFT, SCROLLBAR_RIGHT };
/* Alarm settings */
#ifdef HAVE_RTC_ALARM
enum { ALARM_START_WPS = 0,
@ -560,7 +563,11 @@ struct user_settings
bool buttonbar; /* 0=hide, 1=show */
#endif
bool scrollbar; /* 0=hide, 1=show */
#ifdef HAVE_LCD_BITMAP
int scrollbar; /* SCROLLBAR_* enum values */
int scrollbar_width;
#endif
/* goto current song when exiting WPS */
bool browse_current; /* 1=goto current song,
0=goto previous location */
@ -768,8 +775,6 @@ struct user_settings
#ifdef HAVE_REMOTE_LCD
unsigned char remote_ui_vp_config[64]; /* viewport string for the remote lists */
#endif
int scrollbar_width;
bool scrollbar_position; /* false=left true=right */
#endif
#if CONFIG_CODEC == SWCODEC

View file

@ -609,11 +609,11 @@ const struct settings_list settings[] = {
gui_statusbar_changed, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP),
ID2P(LANG_STATUSBAR_BOTTOM)),
#endif
OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true, "scrollbar", NULL),
CHOICE_SETTING(F_TEMPVAR, scrollbar,
LANG_SCROLL_BAR, SCROLLBAR_LEFT, "scrollbar","off,left,right",
NULL, 3, ID2P(LANG_OFF), ID2P(LANG_LEFT), ID2P(LANG_RIGHT)),
INT_SETTING(0, scrollbar_width, LANG_SCROLLBAR_WIDTH, 6, "scrollbar width",
UNIT_INT, 3, LCD_WIDTH/10, 1, NULL, NULL, NULL),
BOOL_SETTING(F_TEMPVAR, scrollbar_position, LANG_SCROLLBAR_POSITION, false,
"scrollbar pos", "left,right", LANG_RIGHT, LANG_LEFT, NULL),
#if CONFIG_KEYPAD == RECORDER_PAD
OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL),
#endif

View file

@ -234,8 +234,7 @@
\opt{remote}{
remote statusbar & off, top, bottom & N/A\\
}
scrollbar & on, off & N/A\\
scrollbar pos & left, right & N/A\\
scrollbar & off, left, right & N/A\\
scrollbar width & 3 to LCD width / 10 (\fixme{devise a way
to get ranges from config-*.h})& pixels\\
volume display

View file

@ -196,11 +196,10 @@
\item[Status/Scrollbar:]
Settings related to on screen status display and the scrollbar.
\begin{description}
\item[Scroll Bar:] Enables or disables the vertical scroll bar.
\item[Scroll Bar:] Allows you to choose where the vertical scroll bar
should appear.
\item[Scroll Bar Width:] Allows you to choose the width of the
scroll bar (in pixels). Default value is 6.
\item[Scroll Bar Position:] Allows you to choose where the scroll bar
should appear.
\item[Status Bar:] Allows you to choose where to display the
statusbar\opt{remote}{ on the main display}.
\opt{remote}{