diff options
| -rw-r--r-- | apps/gui/bitmap/list.c | 71 | ||||
| -rw-r--r-- | apps/lang/english.lang | 36 | ||||
| -rw-r--r-- | apps/menus/display_menu.c | 5 | ||||
| -rw-r--r-- | apps/settings.h | 1 | ||||
| -rw-r--r-- | apps/settings_list.c | 2 |
5 files changed, 72 insertions, 43 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index a1b0c79..578c9ce 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c @@ -130,10 +130,13 @@ void list_draw(struct screen *display, struct gui_synclist *list) vp = list_text[screen]; vp.width = SCROLLBAR_WIDTH; list_text[screen].width -= SCROLLBAR_WIDTH; - list_text[screen].x += SCROLLBAR_WIDTH; + if(global_settings.scrollbar_position) /* 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 */ + vp.x += list_text[screen].width; display->set_viewport(&vp); gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, vp.height, list->nb_items, @@ -144,8 +147,11 @@ void list_draw(struct screen *display, struct gui_synclist *list) else if (show_title) { /* shift everything right a bit... */ - list_text[screen].width -= SCROLLBAR_WIDTH; - list_text[screen].x += SCROLLBAR_WIDTH; + if(global_settings.scrollbar_position) /* left */ + { + list_text[screen].width -= SCROLLBAR_WIDTH; + list_text[screen].x += SCROLLBAR_WIDTH; + } } /* setup icon placement */ @@ -284,6 +290,35 @@ void list_draw(struct screen *display, struct gui_synclist *list) */ static bool scrolling=false; +static int gui_synclist_touchscreen_scrollbar(struct gui_synclist * gui_list, + int y) +{ + int screen = screens[SCREEN_MAIN].screen_type; + int nb_lines = viewport_get_nb_lines(&list_text[screen]); + if (nb_lines < gui_list->nb_items) + { + int scrollbar_size = nb_lines* + font_get(gui_list->parent[screen]->font)->height; + int actual_y = y - list_text[screen].y; + + int new_selection = (actual_y * gui_list->nb_items) + / scrollbar_size; + + int start_item = new_selection - nb_lines/2; + if(start_item < 0) + start_item = 0; + else if(start_item > gui_list->nb_items - nb_lines) + start_item = gui_list->nb_items - nb_lines; + + gui_list->start_item[screen] = start_item; + gui_synclist_select_item(gui_list, new_selection); + + return ACTION_REDRAW; + } + + return ACTION_NONE; +} + unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) { short x, y; @@ -306,33 +341,15 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) return ACTION_NONE; } /* Scroll bar */ - else - { - int nb_lines = viewport_get_nb_lines(&list_text[screen]); - if (nb_lines < gui_list->nb_items) - { - int scrollbar_size = nb_lines* - font_get(gui_list->parent[screen]->font)->height; - int actual_y = y - list_text[screen].y; - - int new_selection = (actual_y * gui_list->nb_items) - / scrollbar_size; - - int start_item = new_selection - nb_lines/2; - if(start_item < 0) - start_item = 0; - else if(start_item > gui_list->nb_items - nb_lines) - start_item = gui_list->nb_items - nb_lines; - - gui_list->start_item[screen] = start_item; - gui_synclist_select_item(gui_list, new_selection); - - return ACTION_REDRAW; - } - } + else if(global_settings.scrollbar_position) /* 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*/ + return gui_synclist_touchscreen_scrollbar(gui_list, y); + /* |--------------------------------------------------------| * | Description of the touchscreen list interface: | * |--------------------------------------------------------| diff --git a/apps/lang/english.lang b/apps/lang/english.lang index ed0e062..85e8739 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -12224,36 +12224,30 @@ </phrase> <phrase> id: LANG_LEFT - desc: DEPRECATED + desc: Generic use of 'left' user: core <source> - *: none - quickscreen: "" + *: "Left" </source> <dest> - *: none - quickscreen: "" + *: "Left" </dest> <voice> - *: none - quickscreen: "" + *: "Left" </voice> </phrase> <phrase> id: LANG_RIGHT - desc: DEPRECATED + desc: Generic use of 'right user: core <source> - *: none - quickscreen: "" + *: "Right" </source> <dest> - *: none - quickscreen: "" + *: "Right" </dest> <voice> - *: none - quickscreen: "" + *: "Right" </voice> </phrase> <phrase> @@ -12685,3 +12679,17 @@ *: "Scroll bar width" </voice> </phrase> +<phrase> + id: LANG_SCROLLBAR_POSITION + desc: in Settings -> General -> Display -> Status-/Scrollbar + user: core + <source> + *: "Scroll Bar Position" + </source> + <dest> + *: "Scroll Bar Position" + </dest> + <voice> + *: "Scroll bar position" + </voice> +</phrase> diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index ab13aac..a98a3d5 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -320,6 +320,8 @@ static int statusbar_callback(int action,const struct menu_item_ex *this_item) return action; } 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); @@ -329,9 +331,8 @@ MENUITEM_SETTING(buttonbar, &global_settings.buttonbar, NULL); #endif MENUITEM_SETTING(volume_type, &global_settings.volume_type, NULL); MENUITEM_SETTING(battery_display, &global_settings.battery_display, NULL); -MENUITEM_SETTING(scrollbar_width, &global_settings.scrollbar_width, NULL); MAKE_MENU(bars_menu, ID2P(LANG_BARS_MENU), 0, Icon_NOICON, - &scrollbar_item, &scrollbar_width, &statusbar, + &scrollbar_item, &scrollbar_width, &scrollbar_position, &statusbar, #ifdef HAVE_REMOTE_LCD &remote_statusbar, #endif diff --git a/apps/settings.h b/apps/settings.h index 2167e48..e999534 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -770,6 +770,7 @@ struct user_settings #endif #endif int scrollbar_width; + bool scrollbar_position; /* true=left false=right */ }; /** global variables **/ diff --git a/apps/settings_list.c b/apps/settings_list.c index ffea57d..86972a1 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -607,6 +607,8 @@ const struct settings_list settings[] = { OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true, "scrollbar", NULL), INT_SETTING(0, scrollbar_width, LANG_SCROLLBAR_WIDTH, 6, "scrollbar width", UNIT_INT, 3, LCD_WIDTH/10, 1, NULL, NULL, NULL), + BOOL_SETTING(0, scrollbar_position, LANG_SCROLLBAR_POSITION, true, + "scrollbar pos", "left,right", LANG_LEFT, LANG_RIGHT, NULL), #if CONFIG_KEYPAD == RECORDER_PAD OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL), #endif |