summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/bitmap/list.c71
-rw-r--r--apps/lang/english.lang36
-rw-r--r--apps/menus/display_menu.c5
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c2
5 files changed, 72 insertions, 43 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index a1b0c79eaa..578c9ced72 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)
130 vp = list_text[screen]; 130 vp = list_text[screen];
131 vp.width = SCROLLBAR_WIDTH; 131 vp.width = SCROLLBAR_WIDTH;
132 list_text[screen].width -= SCROLLBAR_WIDTH; 132 list_text[screen].width -= SCROLLBAR_WIDTH;
133 list_text[screen].x += SCROLLBAR_WIDTH; 133 if(global_settings.scrollbar_position) /* left */
134 list_text[screen].x += SCROLLBAR_WIDTH;
134 vp.height = line_height * 135 vp.height = line_height *
135 viewport_get_nb_lines(&list_text[screen]); 136 viewport_get_nb_lines(&list_text[screen]);
136 vp.x = parent->x; 137 vp.x = parent->x;
138 if(!global_settings.scrollbar_position) /* right */
139 vp.x += list_text[screen].width;
137 display->set_viewport(&vp); 140 display->set_viewport(&vp);
138 gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, 141 gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1,
139 vp.height, list->nb_items, 142 vp.height, list->nb_items,
@@ -144,8 +147,11 @@ void list_draw(struct screen *display, struct gui_synclist *list)
144 else if (show_title) 147 else if (show_title)
145 { 148 {
146 /* shift everything right a bit... */ 149 /* shift everything right a bit... */
147 list_text[screen].width -= SCROLLBAR_WIDTH; 150 if(global_settings.scrollbar_position) /* left */
148 list_text[screen].x += SCROLLBAR_WIDTH; 151 {
152 list_text[screen].width -= SCROLLBAR_WIDTH;
153 list_text[screen].x += SCROLLBAR_WIDTH;
154 }
149 } 155 }
150 156
151 /* setup icon placement */ 157 /* setup icon placement */
@@ -284,6 +290,35 @@ void list_draw(struct screen *display, struct gui_synclist *list)
284 */ 290 */
285static bool scrolling=false; 291static bool scrolling=false;
286 292
293static int gui_synclist_touchscreen_scrollbar(struct gui_synclist * gui_list,
294 int y)
295{
296 int screen = screens[SCREEN_MAIN].screen_type;
297 int nb_lines = viewport_get_nb_lines(&list_text[screen]);
298 if (nb_lines < gui_list->nb_items)
299 {
300 int scrollbar_size = nb_lines*
301 font_get(gui_list->parent[screen]->font)->height;
302 int actual_y = y - list_text[screen].y;
303
304 int new_selection = (actual_y * gui_list->nb_items)
305 / scrollbar_size;
306
307 int start_item = new_selection - nb_lines/2;
308 if(start_item < 0)
309 start_item = 0;
310 else if(start_item > gui_list->nb_items - nb_lines)
311 start_item = gui_list->nb_items - nb_lines;
312
313 gui_list->start_item[screen] = start_item;
314 gui_synclist_select_item(gui_list, new_selection);
315
316 return ACTION_REDRAW;
317 }
318
319 return ACTION_NONE;
320}
321
287unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) 322unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
288{ 323{
289 short x, y; 324 short x, y;
@@ -306,33 +341,15 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
306 return ACTION_NONE; 341 return ACTION_NONE;
307 } 342 }
308 /* Scroll bar */ 343 /* Scroll bar */
309 else 344 else if(global_settings.scrollbar_position) /* left */
310 { 345 return gui_synclist_touchscreen_scrollbar(gui_list, y);
311 int nb_lines = viewport_get_nb_lines(&list_text[screen]);
312 if (nb_lines < gui_list->nb_items)
313 {
314 int scrollbar_size = nb_lines*
315 font_get(gui_list->parent[screen]->font)->height;
316 int actual_y = y - list_text[screen].y;
317
318 int new_selection = (actual_y * gui_list->nb_items)
319 / scrollbar_size;
320
321 int start_item = new_selection - nb_lines/2;
322 if(start_item < 0)
323 start_item = 0;
324 else if(start_item > gui_list->nb_items - nb_lines)
325 start_item = gui_list->nb_items - nb_lines;
326
327 gui_list->start_item[screen] = start_item;
328 gui_synclist_select_item(gui_list, new_selection);
329
330 return ACTION_REDRAW;
331 }
332 }
333 } 346 }
334 else 347 else
335 { 348 {
349 if(x>list_text[screen].x+list_text[screen].width &&
350 !global_settings.scrollbar_position) /* right*/
351 return gui_synclist_touchscreen_scrollbar(gui_list, y);
352
336 /* |--------------------------------------------------------| 353 /* |--------------------------------------------------------|
337 * | Description of the touchscreen list interface: | 354 * | Description of the touchscreen list interface: |
338 * |--------------------------------------------------------| 355 * |--------------------------------------------------------|
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index ed0e06220a..85e8739576 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -12224,36 +12224,30 @@
12224</phrase> 12224</phrase>
12225<phrase> 12225<phrase>
12226 id: LANG_LEFT 12226 id: LANG_LEFT
12227 desc: DEPRECATED 12227 desc: Generic use of 'left'
12228 user: core 12228 user: core
12229 <source> 12229 <source>
12230 *: none 12230 *: "Left"
12231 quickscreen: ""
12232 </source> 12231 </source>
12233 <dest> 12232 <dest>
12234 *: none 12233 *: "Left"
12235 quickscreen: ""
12236 </dest> 12234 </dest>
12237 <voice> 12235 <voice>
12238 *: none 12236 *: "Left"
12239 quickscreen: ""
12240 </voice> 12237 </voice>
12241</phrase> 12238</phrase>
12242<phrase> 12239<phrase>
12243 id: LANG_RIGHT 12240 id: LANG_RIGHT
12244 desc: DEPRECATED 12241 desc: Generic use of 'right
12245 user: core 12242 user: core
12246 <source> 12243 <source>
12247 *: none 12244 *: "Right"
12248 quickscreen: ""
12249 </source> 12245 </source>
12250 <dest> 12246 <dest>
12251 *: none 12247 *: "Right"
12252 quickscreen: ""
12253 </dest> 12248 </dest>
12254 <voice> 12249 <voice>
12255 *: none 12250 *: "Right"
12256 quickscreen: ""
12257 </voice> 12251 </voice>
12258</phrase> 12252</phrase>
12259<phrase> 12253<phrase>
@@ -12685,3 +12679,17 @@
12685 *: "Scroll bar width" 12679 *: "Scroll bar width"
12686 </voice> 12680 </voice>
12687</phrase> 12681</phrase>
12682<phrase>
12683 id: LANG_SCROLLBAR_POSITION
12684 desc: in Settings -> General -> Display -> Status-/Scrollbar
12685 user: core
12686 <source>
12687 *: "Scroll Bar Position"
12688 </source>
12689 <dest>
12690 *: "Scroll Bar Position"
12691 </dest>
12692 <voice>
12693 *: "Scroll bar position"
12694 </voice>
12695</phrase>
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index ab13aac4ab..a98a3d51b0 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)
320 return action; 320 return action;
321} 321}
322MENUITEM_SETTING(scrollbar_item, &global_settings.scrollbar, NULL); 322MENUITEM_SETTING(scrollbar_item, &global_settings.scrollbar, NULL);
323MENUITEM_SETTING(scrollbar_width, &global_settings.scrollbar_width, NULL);
324MENUITEM_SETTING(scrollbar_position, &global_settings.scrollbar_position, NULL);
323MENUITEM_SETTING(statusbar, &global_settings.statusbar, statusbar_callback); 325MENUITEM_SETTING(statusbar, &global_settings.statusbar, statusbar_callback);
324#ifdef HAVE_REMOTE_LCD 326#ifdef HAVE_REMOTE_LCD
325MENUITEM_SETTING(remote_statusbar, &global_settings.remote_statusbar, statusbar_callback); 327MENUITEM_SETTING(remote_statusbar, &global_settings.remote_statusbar, statusbar_callback);
@@ -329,9 +331,8 @@ MENUITEM_SETTING(buttonbar, &global_settings.buttonbar, NULL);
329#endif 331#endif
330MENUITEM_SETTING(volume_type, &global_settings.volume_type, NULL); 332MENUITEM_SETTING(volume_type, &global_settings.volume_type, NULL);
331MENUITEM_SETTING(battery_display, &global_settings.battery_display, NULL); 333MENUITEM_SETTING(battery_display, &global_settings.battery_display, NULL);
332MENUITEM_SETTING(scrollbar_width, &global_settings.scrollbar_width, NULL);
333MAKE_MENU(bars_menu, ID2P(LANG_BARS_MENU), 0, Icon_NOICON, 334MAKE_MENU(bars_menu, ID2P(LANG_BARS_MENU), 0, Icon_NOICON,
334 &scrollbar_item, &scrollbar_width, &statusbar, 335 &scrollbar_item, &scrollbar_width, &scrollbar_position, &statusbar,
335#ifdef HAVE_REMOTE_LCD 336#ifdef HAVE_REMOTE_LCD
336 &remote_statusbar, 337 &remote_statusbar,
337#endif 338#endif
diff --git a/apps/settings.h b/apps/settings.h
index 2167e48261..e999534eb0 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -770,6 +770,7 @@ struct user_settings
770#endif 770#endif
771#endif 771#endif
772 int scrollbar_width; 772 int scrollbar_width;
773 bool scrollbar_position; /* true=left false=right */
773}; 774};
774 775
775/** global variables **/ 776/** global variables **/
diff --git a/apps/settings_list.c b/apps/settings_list.c
index ffea57d355..86972a132d 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -607,6 +607,8 @@ const struct settings_list settings[] = {
607 OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true, "scrollbar", NULL), 607 OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true, "scrollbar", NULL),
608 INT_SETTING(0, scrollbar_width, LANG_SCROLLBAR_WIDTH, 6, "scrollbar width", 608 INT_SETTING(0, scrollbar_width, LANG_SCROLLBAR_WIDTH, 6, "scrollbar width",
609 UNIT_INT, 3, LCD_WIDTH/10, 1, NULL, NULL, NULL), 609 UNIT_INT, 3, LCD_WIDTH/10, 1, NULL, NULL, NULL),
610 BOOL_SETTING(0, scrollbar_position, LANG_SCROLLBAR_POSITION, true,
611 "scrollbar pos", "left,right", LANG_LEFT, LANG_RIGHT, NULL),
610#if CONFIG_KEYPAD == RECORDER_PAD 612#if CONFIG_KEYPAD == RECORDER_PAD
611 OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL), 613 OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL),
612#endif 614#endif