2008-03-05 09:58:30 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Jonathan Gordon
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-03-05 09:58:30 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* This file contains the code to draw the list widget on BITMAP LCDs. */
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "font.h"
|
|
|
|
#include "button.h"
|
|
|
|
#include "sprintf.h"
|
|
|
|
#include "string.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "system.h"
|
|
|
|
|
|
|
|
#include "action.h"
|
|
|
|
#include "screen_access.h"
|
|
|
|
#include "list.h"
|
|
|
|
#include "scrollbar.h"
|
|
|
|
#include "statusbar.h"
|
|
|
|
#include "lang.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "talk.h"
|
|
|
|
#include "viewport.h"
|
|
|
|
|
|
|
|
#define SCROLLBAR_WIDTH 6
|
|
|
|
#define ICON_PADDING 1
|
|
|
|
|
2008-12-31 05:59:26 +00:00
|
|
|
/* these are static to make scrolling work */
|
|
|
|
static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS];
|
2008-03-05 09:58:30 +00:00
|
|
|
|
|
|
|
int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width,
|
|
|
|
int text_pos, struct screen * display,
|
|
|
|
struct viewport *vp);
|
2008-12-31 05:59:26 +00:00
|
|
|
bool list_display_title(struct gui_synclist *list, enum screen_type screen);
|
2008-03-05 09:58:30 +00:00
|
|
|
|
|
|
|
/* Draw the list...
|
|
|
|
internal screen layout:
|
|
|
|
-----------------
|
|
|
|
|TI| title | TI is title icon
|
|
|
|
-----------------
|
|
|
|
| | | |
|
|
|
|
|S|I| | S - scrollbar
|
|
|
|
| | | items | I - icons
|
|
|
|
| | | |
|
|
|
|
------------------
|
|
|
|
*/
|
2008-12-31 05:59:26 +00:00
|
|
|
static bool draw_title(struct screen *display, struct gui_synclist *list)
|
2008-03-05 09:58:30 +00:00
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
const int screen = display->screen_type;
|
2009-03-08 12:42:33 +00:00
|
|
|
int style = STYLE_DEFAULT;
|
2008-12-31 05:59:26 +00:00
|
|
|
if (!list_display_title(list, screen))
|
2008-03-05 09:58:30 +00:00
|
|
|
return false;
|
2008-12-31 05:59:26 +00:00
|
|
|
title_text[screen] = *(list->parent[screen]);
|
2009-01-28 18:06:58 +00:00
|
|
|
title_text[screen].height = font_get(title_text[screen].font)->height;
|
|
|
|
|
2008-03-05 09:58:30 +00:00
|
|
|
if (list->title_icon != Icon_NOICON && global_settings.show_icons)
|
|
|
|
{
|
2009-01-28 18:06:58 +00:00
|
|
|
struct viewport title_icon = title_text[screen];
|
2008-12-31 05:59:26 +00:00
|
|
|
title_icon.width = get_icon_width(screen)
|
2008-03-05 09:58:30 +00:00
|
|
|
+ ICON_PADDING*2;
|
2008-12-31 05:59:26 +00:00
|
|
|
title_icon.x += ICON_PADDING;
|
|
|
|
|
2009-01-28 18:06:58 +00:00
|
|
|
title_text[screen].width -= title_icon.width;
|
|
|
|
title_text[screen].x += title_icon.width;
|
2008-12-31 05:59:26 +00:00
|
|
|
|
|
|
|
display->set_viewport(&title_icon);
|
2008-03-05 09:58:30 +00:00
|
|
|
screen_put_icon(display, 0, 0, list->title_icon);
|
|
|
|
}
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
if (list->title_color >= 0)
|
|
|
|
{
|
2009-03-08 12:42:33 +00:00
|
|
|
style |= (STYLE_COLORED|list->title_color);
|
2008-12-31 05:59:26 +00:00
|
|
|
}
|
2008-03-05 09:58:30 +00:00
|
|
|
#endif
|
2008-12-31 05:59:26 +00:00
|
|
|
display->set_viewport(&title_text[screen]);
|
2009-03-08 12:42:33 +00:00
|
|
|
display->puts_scroll_style(0, 0, list->title, style);
|
2008-03-05 09:58:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-12-31 05:59:26 +00:00
|
|
|
void list_draw(struct screen *display, struct gui_synclist *list)
|
2008-03-05 09:58:30 +00:00
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
struct viewport list_icons;
|
2009-03-08 12:42:33 +00:00
|
|
|
int start, end, line_height, style, i;
|
2008-12-31 05:59:26 +00:00
|
|
|
const int screen = display->screen_type;
|
|
|
|
const int icon_width = get_icon_width(screen) + ICON_PADDING;
|
|
|
|
const bool show_cursor = !global_settings.cursor_style &&
|
2008-03-05 09:58:30 +00:00
|
|
|
list->show_selection_marker;
|
2008-12-31 05:59:26 +00:00
|
|
|
struct viewport *parent = (list->parent[screen]);
|
2008-03-05 09:58:30 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
unsigned char cur_line = 0;
|
|
|
|
#endif
|
|
|
|
int item_offset;
|
|
|
|
bool show_title;
|
|
|
|
line_height = font_get(parent->font)->height;
|
|
|
|
display->set_viewport(parent);
|
|
|
|
display->clear_viewport();
|
|
|
|
display->stop_scroll();
|
2008-12-31 05:59:26 +00:00
|
|
|
list_text[screen] = *parent;
|
|
|
|
if ((show_title = draw_title(display, list)))
|
2008-03-05 09:58:30 +00:00
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
list_text[screen].y += line_height;
|
|
|
|
list_text[screen].height -= line_height;
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
2008-12-31 05:59:26 +00:00
|
|
|
|
|
|
|
start = list->start_item[screen];
|
|
|
|
end = start + viewport_get_nb_lines(&list_text[screen]);
|
2008-03-05 09:58:30 +00:00
|
|
|
|
|
|
|
/* draw the scrollbar if its needed */
|
|
|
|
if (global_settings.scrollbar &&
|
2008-12-31 05:59:26 +00:00
|
|
|
viewport_get_nb_lines(&list_text[screen]) < list->nb_items)
|
2008-03-05 09:58:30 +00:00
|
|
|
{
|
|
|
|
struct viewport vp;
|
2008-12-31 05:59:26 +00:00
|
|
|
vp = list_text[screen];
|
2008-03-05 09:58:30 +00:00
|
|
|
vp.width = SCROLLBAR_WIDTH;
|
2008-12-31 05:59:26 +00:00
|
|
|
list_text[screen].width -= SCROLLBAR_WIDTH;
|
|
|
|
list_text[screen].x += SCROLLBAR_WIDTH;
|
2008-03-05 09:58:30 +00:00
|
|
|
vp.height = line_height *
|
2008-12-31 05:59:26 +00:00
|
|
|
viewport_get_nb_lines(&list_text[screen]);
|
2008-03-05 09:58:30 +00:00
|
|
|
vp.x = parent->x;
|
|
|
|
display->set_viewport(&vp);
|
|
|
|
gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1,
|
|
|
|
vp.height, list->nb_items,
|
2008-12-31 05:59:26 +00:00
|
|
|
list->start_item[screen],
|
|
|
|
list->start_item[screen] + end-start,
|
2008-03-05 09:58:30 +00:00
|
|
|
VERTICAL);
|
|
|
|
}
|
|
|
|
else if (show_title)
|
|
|
|
{
|
|
|
|
/* shift everything right a bit... */
|
2008-12-31 05:59:26 +00:00
|
|
|
list_text[screen].width -= SCROLLBAR_WIDTH;
|
|
|
|
list_text[screen].x += SCROLLBAR_WIDTH;
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* setup icon placement */
|
2008-12-31 05:59:26 +00:00
|
|
|
list_icons = list_text[screen];
|
2008-03-05 09:58:30 +00:00
|
|
|
int icon_count = global_settings.show_icons &&
|
|
|
|
(list->callback_get_item_icon != NULL) ? 1 : 0;
|
|
|
|
if (show_cursor)
|
|
|
|
icon_count++;
|
|
|
|
if (icon_count)
|
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
list_icons.width = icon_width * icon_count;
|
|
|
|
list_text[screen].width -=
|
|
|
|
list_icons.width + ICON_PADDING;
|
|
|
|
list_text[screen].x +=
|
|
|
|
list_icons.width + ICON_PADDING;
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i=start; i<end && i<list->nb_items; i++)
|
|
|
|
{
|
|
|
|
/* do the text */
|
|
|
|
unsigned char *s;
|
|
|
|
char entry_buffer[MAX_PATH];
|
|
|
|
unsigned char *entry_name;
|
|
|
|
int text_pos = 0;
|
2008-04-09 15:25:17 +00:00
|
|
|
s = list->callback_get_item_name(i, list->data, entry_buffer,
|
|
|
|
sizeof(entry_buffer));
|
2008-03-05 09:58:30 +00:00
|
|
|
entry_name = P2STR(s);
|
2008-12-31 05:59:26 +00:00
|
|
|
display->set_viewport(&list_text[screen]);
|
2009-03-08 12:42:33 +00:00
|
|
|
style = STYLE_DEFAULT;
|
2008-03-05 09:58:30 +00:00
|
|
|
/* position the string at the correct offset place */
|
|
|
|
int item_width,h;
|
|
|
|
display->getstringsize(entry_name, &item_width, &h);
|
|
|
|
item_offset = gui_list_get_item_offset(list, item_width,
|
|
|
|
text_pos, display,
|
2008-12-31 05:59:26 +00:00
|
|
|
&list_text[screen]);
|
2008-03-05 09:58:30 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
/* if the list has a color callback */
|
|
|
|
if (list->callback_get_item_color)
|
|
|
|
{
|
|
|
|
int color = list->callback_get_item_color(i, list->data);
|
|
|
|
/* if color selected */
|
|
|
|
if (color >= 0)
|
|
|
|
{
|
2009-03-08 12:42:33 +00:00
|
|
|
style |= STYLE_COLORED|color;
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2008-12-31 05:59:26 +00:00
|
|
|
if(i >= list->selected_item && i < list->selected_item
|
|
|
|
+ list->selected_size && list->show_selection_marker)
|
2008-03-05 09:58:30 +00:00
|
|
|
{/* The selected item must be displayed scrolling */
|
2008-04-03 04:41:42 +00:00
|
|
|
if (global_settings.cursor_style == 1
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2008-12-31 05:59:26 +00:00
|
|
|
/* the global_settings.cursor_style check is here to make
|
|
|
|
* sure if they want the cursor instead of bar it will work
|
|
|
|
*/
|
2008-04-03 04:41:42 +00:00
|
|
|
|| (display->depth < 16 && global_settings.cursor_style)
|
|
|
|
#endif
|
|
|
|
)
|
2008-03-05 09:58:30 +00:00
|
|
|
{
|
|
|
|
/* Display inverted-line-style */
|
2009-03-08 12:42:33 +00:00
|
|
|
style = STYLE_INVERT;
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
else if (global_settings.cursor_style == 2)
|
|
|
|
{
|
|
|
|
/* Display colour line selector */
|
2009-03-08 12:42:33 +00:00
|
|
|
style = STYLE_COLORBAR;
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
|
|
|
else if (global_settings.cursor_style == 3)
|
|
|
|
{
|
|
|
|
/* Display gradient line selector */
|
2009-03-08 12:42:33 +00:00
|
|
|
style = STYLE_GRADIENT;
|
2008-03-05 09:58:30 +00:00
|
|
|
|
|
|
|
/* Make the lcd driver know how many lines the gradient should
|
|
|
|
cover and current line number */
|
|
|
|
/* number of selected lines */
|
2009-03-08 12:42:33 +00:00
|
|
|
style |= NUMLN_PACK(list->selected_size);
|
2008-03-05 09:58:30 +00:00
|
|
|
/* current line number, zero based */
|
2009-03-08 12:42:33 +00:00
|
|
|
style |= CURLN_PACK(cur_line);
|
2008-03-05 09:58:30 +00:00
|
|
|
cur_line++;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/* if the text is smaller than the viewport size */
|
2008-12-31 05:59:26 +00:00
|
|
|
if (item_offset> item_width
|
|
|
|
- (list_text[screen].width - text_pos))
|
2008-03-05 09:58:30 +00:00
|
|
|
{
|
|
|
|
/* don't scroll */
|
|
|
|
display->puts_style_offset(0, i-start, entry_name,
|
2009-03-08 12:42:33 +00:00
|
|
|
style, item_offset);
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
display->puts_scroll_style_offset(0, i-start, entry_name,
|
2009-03-08 12:42:33 +00:00
|
|
|
style, item_offset);
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2008-07-05 12:31:04 +00:00
|
|
|
{
|
|
|
|
if (list->scroll_all)
|
|
|
|
display->puts_scroll_style_offset(0, i-start, entry_name,
|
2009-03-08 12:42:33 +00:00
|
|
|
style, item_offset);
|
2008-07-05 12:31:04 +00:00
|
|
|
else
|
|
|
|
display->puts_style_offset(0, i-start, entry_name,
|
2009-03-08 12:42:33 +00:00
|
|
|
style, item_offset);
|
2008-07-05 12:31:04 +00:00
|
|
|
}
|
2008-03-05 09:58:30 +00:00
|
|
|
/* do the icon */
|
|
|
|
if (list->callback_get_item_icon && global_settings.show_icons)
|
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
display->set_viewport(&list_icons);
|
2008-03-05 09:58:30 +00:00
|
|
|
screen_put_icon_with_offset(display, show_cursor?1:0,
|
2008-12-31 05:59:26 +00:00
|
|
|
(i-start),show_cursor?ICON_PADDING:0,0,
|
|
|
|
list->callback_get_item_icon(i, list->data));
|
2008-03-05 09:58:30 +00:00
|
|
|
if (show_cursor && i >= list->selected_item &&
|
|
|
|
i < list->selected_item + list->selected_size)
|
|
|
|
{
|
|
|
|
screen_put_icon(display, 0, i-start, Icon_Cursor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (show_cursor && i >= list->selected_item &&
|
|
|
|
i < list->selected_item + list->selected_size)
|
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
display->set_viewport(&list_icons);
|
2008-03-05 09:58:30 +00:00
|
|
|
screen_put_icon(display, 0, (i-start), Icon_Cursor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
display->set_viewport(parent);
|
|
|
|
display->update_viewport();
|
2009-01-07 07:52:32 +00:00
|
|
|
display->set_viewport(NULL);
|
2008-03-05 09:58:30 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#if defined(HAVE_TOUCHSCREEN)
|
2008-06-02 16:08:01 +00:00
|
|
|
/* This needs to be fixed if we ever get more than 1 touchscreen on a target.
|
|
|
|
* This also assumes the whole screen is used, which is a bad assumption but
|
|
|
|
* fine until customizable lists comes in...
|
|
|
|
*/
|
2008-06-02 18:59:32 +00:00
|
|
|
static bool scrolling=false;
|
2008-06-02 16:08:01 +00:00
|
|
|
|
2008-12-31 05:59:26 +00:00
|
|
|
unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
|
2008-03-05 10:38:10 +00:00
|
|
|
{
|
2008-06-02 16:08:01 +00:00
|
|
|
short x, y;
|
2008-12-31 05:59:26 +00:00
|
|
|
int button = action_get_touchscreen_press(&x, &y);
|
2008-03-05 10:38:10 +00:00
|
|
|
int line;
|
|
|
|
struct screen *display = &screens[SCREEN_MAIN];
|
2008-12-31 06:11:23 +00:00
|
|
|
int screen = display->screen_type;
|
2008-03-05 10:38:10 +00:00
|
|
|
if (button == BUTTON_NONE)
|
|
|
|
return ACTION_NONE;
|
2008-12-31 06:11:23 +00:00
|
|
|
if (x<list_text[screen].x)
|
2008-03-05 10:38:10 +00:00
|
|
|
{
|
2009-02-12 15:58:55 +00:00
|
|
|
/* Top left corner is GO_TO_ROOT */
|
2008-03-05 10:38:10 +00:00
|
|
|
if (y<list_text[SCREEN_MAIN].y)
|
|
|
|
{
|
|
|
|
if (button == BUTTON_REL)
|
|
|
|
return ACTION_STD_MENU;
|
2008-06-01 13:56:34 +00:00
|
|
|
else if (button == (BUTTON_REPEAT|BUTTON_REL))
|
2008-03-05 10:38:10 +00:00
|
|
|
return ACTION_STD_CONTEXT;
|
|
|
|
else
|
|
|
|
return ACTION_NONE;
|
|
|
|
}
|
2008-06-02 16:08:01 +00:00
|
|
|
/* Scroll bar */
|
2008-03-05 10:38:10 +00:00
|
|
|
else
|
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
int nb_lines = viewport_get_nb_lines(&list_text[screen]);
|
2008-03-05 10:38:10 +00:00
|
|
|
if (nb_lines < gui_list->nb_items)
|
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
int scrollbar_size = nb_lines*
|
|
|
|
font_get(gui_list->parent[screen]->font)->height;
|
|
|
|
int actual_y = y - list_text[screen].y;
|
2008-05-30 22:55:24 +00:00
|
|
|
|
2008-12-31 05:59:26 +00:00
|
|
|
int new_selection = (actual_y * gui_list->nb_items)
|
|
|
|
/ scrollbar_size;
|
2008-06-28 23:48:37 +00:00
|
|
|
|
|
|
|
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;
|
2008-05-30 22:55:24 +00:00
|
|
|
|
2008-12-31 05:59:26 +00:00
|
|
|
gui_list->start_item[screen] = start_item;
|
2008-05-30 22:55:24 +00:00
|
|
|
gui_synclist_select_item(gui_list, new_selection);
|
2008-06-28 23:48:37 +00:00
|
|
|
|
2008-03-05 10:38:10 +00:00
|
|
|
return ACTION_REDRAW;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-06-02 16:08:01 +00:00
|
|
|
/* |--------------------------------------------------------|
|
|
|
|
* | Description of the touchscreen list interface: |
|
|
|
|
* |--------------------------------------------------------|
|
|
|
|
* | Pressing an item will select it and "enter" it. |
|
|
|
|
* | |
|
|
|
|
* | Pressing and holding your pen down will scroll through |
|
2008-06-02 18:59:32 +00:00
|
|
|
* | the list of items. |
|
2008-06-02 16:08:01 +00:00
|
|
|
* | |
|
|
|
|
* | Pressing and holding your pen down on a single item |
|
|
|
|
* | will bring up the context menu of it. |
|
|
|
|
* |--------------------------------------------------------|
|
|
|
|
*/
|
2009-02-12 15:58:55 +00:00
|
|
|
if (y > list_text[screen].y || button & BUTTON_REPEAT)
|
2008-03-05 10:38:10 +00:00
|
|
|
{
|
2008-06-06 18:44:59 +00:00
|
|
|
int line_height, actual_y;
|
2008-06-06 18:29:46 +00:00
|
|
|
|
2009-02-19 16:16:22 +00:00
|
|
|
actual_y = y - list_text[screen].y;
|
2008-12-31 05:59:26 +00:00
|
|
|
line_height = font_get(gui_list->parent[screen]->font)->height;
|
2008-06-06 18:29:46 +00:00
|
|
|
line = actual_y / line_height;
|
2008-06-02 16:08:01 +00:00
|
|
|
|
2009-02-19 16:16:22 +00:00
|
|
|
/* Pressed below the list*/
|
|
|
|
if (gui_list->start_item[screen]+line >= gui_list->nb_items)
|
2008-05-30 22:55:24 +00:00
|
|
|
return ACTION_NONE;
|
2009-02-19 16:16:22 +00:00
|
|
|
|
|
|
|
/* Pressed a border */
|
|
|
|
if(UNLIKELY(actual_y % line_height == 0))
|
2008-06-28 20:11:51 +00:00
|
|
|
return ACTION_NONE;
|
2009-02-19 16:16:22 +00:00
|
|
|
|
|
|
|
if (line != (gui_list->selected_item - gui_list->start_item[screen])
|
|
|
|
&& button ^ BUTTON_REL)
|
2008-03-05 10:38:10 +00:00
|
|
|
{
|
2008-06-02 18:59:32 +00:00
|
|
|
if(button & BUTTON_REPEAT)
|
|
|
|
scrolling = true;
|
2009-02-19 16:16:22 +00:00
|
|
|
|
2008-12-31 05:59:26 +00:00
|
|
|
gui_synclist_select_item(gui_list, gui_list->start_item[screen]
|
2009-02-19 16:16:22 +00:00
|
|
|
+ line);
|
|
|
|
|
2008-05-30 22:55:24 +00:00
|
|
|
return ACTION_REDRAW;
|
2008-03-05 10:38:10 +00:00
|
|
|
}
|
2008-05-30 22:55:24 +00:00
|
|
|
|
2008-06-01 13:56:34 +00:00
|
|
|
if (button == (BUTTON_REPEAT|BUTTON_REL))
|
2008-05-30 22:55:24 +00:00
|
|
|
{
|
2008-06-02 18:59:32 +00:00
|
|
|
if(!scrolling)
|
2008-05-30 22:55:24 +00:00
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
/* Pen was hold on the same line as the
|
|
|
|
* previously selected one
|
|
|
|
* => simulate long button press
|
2008-06-02 16:08:01 +00:00
|
|
|
*/
|
|
|
|
return ACTION_STD_CONTEXT;
|
2008-05-30 22:55:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
/* Pen was moved across several lines and then released on
|
|
|
|
* this one
|
|
|
|
* => do nothing
|
2008-06-02 16:08:01 +00:00
|
|
|
*/
|
2008-06-02 18:59:32 +00:00
|
|
|
scrolling = false;
|
|
|
|
return ACTION_NONE;
|
2008-05-30 22:55:24 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-19 16:16:22 +00:00
|
|
|
else if(button == BUTTON_REL &&
|
|
|
|
line == gui_list->selected_item - gui_list->start_item[screen])
|
2008-06-02 16:08:01 +00:00
|
|
|
{
|
2008-12-31 05:59:26 +00:00
|
|
|
/* Pen was released on either the same line as the previously
|
|
|
|
* selected one or an other one
|
2008-06-02 16:08:01 +00:00
|
|
|
* => simulate short press
|
|
|
|
*/
|
|
|
|
return ACTION_STD_OK;
|
|
|
|
}
|
2008-03-05 10:38:10 +00:00
|
|
|
else
|
2008-05-30 22:55:24 +00:00
|
|
|
return ACTION_NONE;
|
2008-03-05 10:38:10 +00:00
|
|
|
}
|
2009-02-19 16:16:22 +00:00
|
|
|
/* Everything above the items is cancel */
|
|
|
|
else if (y < list_text[screen].y && button == BUTTON_REL)
|
2008-03-05 10:38:10 +00:00
|
|
|
return ACTION_STD_CANCEL;
|
|
|
|
}
|
|
|
|
return ACTION_NONE;
|
|
|
|
}
|
|
|
|
#endif
|