diff options
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index ce2a3354e4..743e603a02 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -295,11 +295,21 @@ void gui_list_select_next(struct gui_list * gui_list) | |||
295 | gui_list->selected_item++; | 295 | gui_list->selected_item++; |
296 | item_pos = gui_list->selected_item - gui_list->start_item; | 296 | item_pos = gui_list->selected_item - gui_list->start_item; |
297 | end_item = gui_list->start_item + nb_lines; | 297 | end_item = gui_list->start_item + nb_lines; |
298 | /* we start scrolling vertically when reaching the line | 298 | if (global_settings.scroll_paginated) |
299 | * (nb_lines-SCROLL_LIMIT) | 299 | { |
300 | * and when we are not in the last part of the list*/ | 300 | /* When we reach the bottom of the list |
301 | if( item_pos > nb_lines-SCROLL_LIMIT && end_item < gui_list->nb_items ) | 301 | * we jump to a new page if there are more items*/ |
302 | gui_list->start_item++; | 302 | if( item_pos > nb_lines-1 && end_item < gui_list->nb_items ) |
303 | gui_list->start_item = gui_list->selected_item; | ||
304 | } | ||
305 | else | ||
306 | { | ||
307 | /* we start scrolling vertically when reaching the line | ||
308 | * (nb_lines-SCROLL_LIMIT) | ||
309 | * and when we are not in the last part of the list*/ | ||
310 | if( item_pos > nb_lines-SCROLL_LIMIT && end_item < gui_list->nb_items ) | ||
311 | gui_list->start_item++; | ||
312 | } | ||
303 | } | 313 | } |
304 | } | 314 | } |
305 | 315 | ||
@@ -323,10 +333,26 @@ void gui_list_select_previous(struct gui_list * gui_list) | |||
323 | else | 333 | else |
324 | { | 334 | { |
325 | int item_pos; | 335 | int item_pos; |
336 | int nb_lines = gui_list->display->nb_lines; | ||
326 | gui_list->selected_item--; | 337 | gui_list->selected_item--; |
327 | item_pos = gui_list->selected_item - gui_list->start_item; | 338 | item_pos = gui_list->selected_item - gui_list->start_item; |
328 | if( item_pos < SCROLL_LIMIT-1 && gui_list->start_item > 0 ) | 339 | if (global_settings.scroll_paginated) |
329 | gui_list->start_item--; | 340 | { |
341 | /* When we reach the top of the list | ||
342 | * we jump to a new page if there are more items*/ | ||
343 | if( item_pos < 0 && gui_list->start_item > 0 ) | ||
344 | gui_list->start_item = gui_list->selected_item-nb_lines+1; | ||
345 | if( gui_list->start_item < 0 ) | ||
346 | gui_list->start_item = 0; | ||
347 | } | ||
348 | else | ||
349 | { | ||
350 | /* we start scrolling vertically when reaching the line | ||
351 | * (nb_lines-SCROLL_LIMIT) | ||
352 | * and when we are not in the last part of the list*/ | ||
353 | if( item_pos < SCROLL_LIMIT-1 && gui_list->start_item > 0 ) | ||
354 | gui_list->start_item--; | ||
355 | } | ||
330 | } | 356 | } |
331 | } | 357 | } |
332 | 358 | ||