blob: 3b2f16db8c298e4111461799df4d72cf8bd73ef9 [file] [log] [blame]
Jonathan Gordon0e5cec22008-03-05 09:58:30 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Jonathan Gordon
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22/* This file contains the code to draw the list widget on BITMAP LCDs. */
23
24#include "config.h"
25#include "lcd.h"
26#include "font.h"
27#include "button.h"
28#include "sprintf.h"
29#include "string.h"
30#include "settings.h"
31#include "kernel.h"
32#include "system.h"
33
34#include "action.h"
35#include "screen_access.h"
36#include "list.h"
37#include "scrollbar.h"
38#include "statusbar.h"
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000039#include "lang.h"
40#include "sound.h"
41#include "misc.h"
42#include "talk.h"
43#include "viewport.h"
44
45#define SCROLLBAR_WIDTH 6
46#define ICON_PADDING 1
47
Jonathan Gordone385ee12008-12-31 05:59:26 +000048/* these are static to make scrolling work */
49static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS];
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000050
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000051int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width,
52 int text_pos, struct screen * display,
53 struct viewport *vp);
Jonathan Gordone385ee12008-12-31 05:59:26 +000054bool list_display_title(struct gui_synclist *list, enum screen_type screen);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000055
56/* Draw the list...
57 internal screen layout:
58 -----------------
59 |TI| title | TI is title icon
60 -----------------
61 | | | |
62 |S|I| | S - scrollbar
63 | | | items | I - icons
64 | | | |
65 ------------------
66*/
Jonathan Gordone385ee12008-12-31 05:59:26 +000067static bool draw_title(struct screen *display, struct gui_synclist *list)
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000068{
Jonathan Gordone385ee12008-12-31 05:59:26 +000069 const int screen = display->screen_type;
70 if (!list_display_title(list, screen))
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000071 return false;
Jonathan Gordone385ee12008-12-31 05:59:26 +000072 title_text[screen] = *(list->parent[screen]);
73 title_text[screen].height
74 = font_get(title_text[screen].font)->height;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000075 if (list->title_icon != Icon_NOICON && global_settings.show_icons)
76 {
Jonathan Gordone385ee12008-12-31 05:59:26 +000077 struct viewport title_icon = *(list->parent[screen]);
78 title_icon = title_text[screen];
79 title_icon.width = get_icon_width(screen)
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000080 + ICON_PADDING*2;
Jonathan Gordone385ee12008-12-31 05:59:26 +000081 title_icon.x += ICON_PADDING;
82
83 title_text[screen].width -= title_icon.width + title_icon.x;
84 title_text[screen].x += title_icon.width + title_icon.x;
85
86 display->set_viewport(&title_icon);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000087 screen_put_icon(display, 0, 0, list->title_icon);
88 }
Jonathan Gordone385ee12008-12-31 05:59:26 +000089 title_text[screen].drawmode = STYLE_DEFAULT;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000090#ifdef HAVE_LCD_COLOR
91 if (list->title_color >= 0)
92 {
Jonathan Gordone385ee12008-12-31 05:59:26 +000093 title_text[screen].drawmode
94 |= (STYLE_COLORED|list->title_color);
95 }
Jonathan Gordon0e5cec22008-03-05 09:58:30 +000096#endif
Jonathan Gordone385ee12008-12-31 05:59:26 +000097 display->set_viewport(&title_text[screen]);
98 display->puts_scroll_style(0, 0, list->title,
99 title_text[screen].drawmode);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000100 return true;
101}
102
Jonathan Gordone385ee12008-12-31 05:59:26 +0000103void list_draw(struct screen *display, struct gui_synclist *list)
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000104{
Jonathan Gordone385ee12008-12-31 05:59:26 +0000105 struct viewport list_icons;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000106 int start, end, line_height, i;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000107 const int screen = display->screen_type;
108 const int icon_width = get_icon_width(screen) + ICON_PADDING;
109 const bool show_cursor = !global_settings.cursor_style &&
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000110 list->show_selection_marker;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000111 struct viewport *parent = (list->parent[screen]);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000112#ifdef HAVE_LCD_COLOR
113 unsigned char cur_line = 0;
114#endif
115 int item_offset;
116 bool show_title;
117 line_height = font_get(parent->font)->height;
118 display->set_viewport(parent);
119 display->clear_viewport();
120 display->stop_scroll();
Jonathan Gordone385ee12008-12-31 05:59:26 +0000121 list_text[screen] = *parent;
122 if ((show_title = draw_title(display, list)))
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000123 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000124 list_text[screen].y += line_height;
125 list_text[screen].height -= line_height;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000126 }
Jonathan Gordone385ee12008-12-31 05:59:26 +0000127
128 start = list->start_item[screen];
129 end = start + viewport_get_nb_lines(&list_text[screen]);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000130
131 /* draw the scrollbar if its needed */
132 if (global_settings.scrollbar &&
Jonathan Gordone385ee12008-12-31 05:59:26 +0000133 viewport_get_nb_lines(&list_text[screen]) < list->nb_items)
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000134 {
135 struct viewport vp;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000136 vp = list_text[screen];
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000137 vp.width = SCROLLBAR_WIDTH;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000138 list_text[screen].width -= SCROLLBAR_WIDTH;
139 list_text[screen].x += SCROLLBAR_WIDTH;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000140 vp.height = line_height *
Jonathan Gordone385ee12008-12-31 05:59:26 +0000141 viewport_get_nb_lines(&list_text[screen]);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000142 vp.x = parent->x;
143 display->set_viewport(&vp);
144 gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1,
145 vp.height, list->nb_items,
Jonathan Gordone385ee12008-12-31 05:59:26 +0000146 list->start_item[screen],
147 list->start_item[screen] + end-start,
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000148 VERTICAL);
149 }
150 else if (show_title)
151 {
152 /* shift everything right a bit... */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000153 list_text[screen].width -= SCROLLBAR_WIDTH;
154 list_text[screen].x += SCROLLBAR_WIDTH;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000155 }
156
157 /* setup icon placement */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000158 list_icons = list_text[screen];
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000159 int icon_count = global_settings.show_icons &&
160 (list->callback_get_item_icon != NULL) ? 1 : 0;
161 if (show_cursor)
162 icon_count++;
163 if (icon_count)
164 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000165 list_icons.width = icon_width * icon_count;
166 list_text[screen].width -=
167 list_icons.width + ICON_PADDING;
168 list_text[screen].x +=
169 list_icons.width + ICON_PADDING;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000170 }
171
172 for (i=start; i<end && i<list->nb_items; i++)
173 {
174 /* do the text */
175 unsigned char *s;
176 char entry_buffer[MAX_PATH];
177 unsigned char *entry_name;
178 int text_pos = 0;
Nils Wallménius68489612008-04-09 15:25:17 +0000179 s = list->callback_get_item_name(i, list->data, entry_buffer,
180 sizeof(entry_buffer));
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000181 entry_name = P2STR(s);
Jonathan Gordone385ee12008-12-31 05:59:26 +0000182 display->set_viewport(&list_text[screen]);
183 list_text[screen].drawmode = STYLE_DEFAULT;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000184 /* position the string at the correct offset place */
185 int item_width,h;
186 display->getstringsize(entry_name, &item_width, &h);
187 item_offset = gui_list_get_item_offset(list, item_width,
188 text_pos, display,
Jonathan Gordone385ee12008-12-31 05:59:26 +0000189 &list_text[screen]);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000190
191#ifdef HAVE_LCD_COLOR
192 /* if the list has a color callback */
193 if (list->callback_get_item_color)
194 {
195 int color = list->callback_get_item_color(i, list->data);
196 /* if color selected */
197 if (color >= 0)
198 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000199 list_text[screen].drawmode |= STYLE_COLORED|color;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000200 }
201 }
202#endif
Jonathan Gordone385ee12008-12-31 05:59:26 +0000203 if(i >= list->selected_item && i < list->selected_item
204 + list->selected_size && list->show_selection_marker)
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000205 {/* The selected item must be displayed scrolling */
Jonathan Gordon34196ed2008-04-03 04:41:42 +0000206 if (global_settings.cursor_style == 1
207#ifdef HAVE_REMOTE_LCD
Jonathan Gordone385ee12008-12-31 05:59:26 +0000208 /* the global_settings.cursor_style check is here to make
209 * sure if they want the cursor instead of bar it will work
210 */
Jonathan Gordon34196ed2008-04-03 04:41:42 +0000211 || (display->depth < 16 && global_settings.cursor_style)
212#endif
213 )
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000214 {
215 /* Display inverted-line-style */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000216 list_text[screen].drawmode = STYLE_INVERT;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000217 }
218#ifdef HAVE_LCD_COLOR
219 else if (global_settings.cursor_style == 2)
220 {
221 /* Display colour line selector */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000222 list_text[screen].drawmode = STYLE_COLORBAR;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000223 }
224 else if (global_settings.cursor_style == 3)
225 {
226 /* Display gradient line selector */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000227 list_text[screen].drawmode = STYLE_GRADIENT;
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000228
229 /* Make the lcd driver know how many lines the gradient should
230 cover and current line number */
231 /* number of selected lines */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000232 list_text[screen].drawmode |= NUMLN_PACK(list->selected_size);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000233 /* current line number, zero based */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000234 list_text[screen].drawmode |= CURLN_PACK(cur_line);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000235 cur_line++;
236 }
237#endif
238 /* if the text is smaller than the viewport size */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000239 if (item_offset> item_width
240 - (list_text[screen].width - text_pos))
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000241 {
242 /* don't scroll */
243 display->puts_style_offset(0, i-start, entry_name,
Jonathan Gordone385ee12008-12-31 05:59:26 +0000244 list_text[screen].drawmode, item_offset);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000245 }
246 else
247 {
248 display->puts_scroll_style_offset(0, i-start, entry_name,
Jonathan Gordone385ee12008-12-31 05:59:26 +0000249 list_text[screen].drawmode, item_offset);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000250 }
251 }
252 else
Jonathan Gordon311d0482008-07-05 12:31:04 +0000253 {
254 if (list->scroll_all)
255 display->puts_scroll_style_offset(0, i-start, entry_name,
Jonathan Gordone385ee12008-12-31 05:59:26 +0000256 list_text[screen].drawmode, item_offset);
Jonathan Gordon311d0482008-07-05 12:31:04 +0000257 else
258 display->puts_style_offset(0, i-start, entry_name,
Jonathan Gordone385ee12008-12-31 05:59:26 +0000259 list_text[screen].drawmode, item_offset);
Jonathan Gordon311d0482008-07-05 12:31:04 +0000260 }
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000261 /* do the icon */
262 if (list->callback_get_item_icon && global_settings.show_icons)
263 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000264 display->set_viewport(&list_icons);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000265 screen_put_icon_with_offset(display, show_cursor?1:0,
Jonathan Gordone385ee12008-12-31 05:59:26 +0000266 (i-start),show_cursor?ICON_PADDING:0,0,
267 list->callback_get_item_icon(i, list->data));
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000268 if (show_cursor && i >= list->selected_item &&
269 i < list->selected_item + list->selected_size)
270 {
271 screen_put_icon(display, 0, i-start, Icon_Cursor);
272 }
273 }
274 else if (show_cursor && i >= list->selected_item &&
275 i < list->selected_item + list->selected_size)
276 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000277 display->set_viewport(&list_icons);
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000278 screen_put_icon(display, 0, (i-start), Icon_Cursor);
279 }
280 }
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000281 display->set_viewport(parent);
282 display->update_viewport();
Jonathan Gordon0e5cec22008-03-05 09:58:30 +0000283}
284
285
Maurus Cuelenaere1392dc22008-08-23 09:46:38 +0000286#if defined(HAVE_TOUCHSCREEN)
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000287/* This needs to be fixed if we ever get more than 1 touchscreen on a target.
288 * This also assumes the whole screen is used, which is a bad assumption but
289 * fine until customizable lists comes in...
290 */
Maurus Cuelenaere75cac2c2008-06-02 18:59:32 +0000291static bool scrolling=false;
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000292
Jonathan Gordone385ee12008-12-31 05:59:26 +0000293unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000294{
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000295 short x, y;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000296 int button = action_get_touchscreen_press(&x, &y);
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000297 int line;
298 struct screen *display = &screens[SCREEN_MAIN];
299 if (button == BUTTON_NONE)
300 return ACTION_NONE;
301 if (x<list_text[SCREEN_MAIN].x)
302 {
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000303 /* Top left corner is hopefully GO_TO_ROOT */
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000304 if (y<list_text[SCREEN_MAIN].y)
305 {
306 if (button == BUTTON_REL)
307 return ACTION_STD_MENU;
Maurus Cuelenaere5dca53e2008-06-01 13:56:34 +0000308 else if (button == (BUTTON_REPEAT|BUTTON_REL))
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000309 return ACTION_STD_CONTEXT;
310 else
311 return ACTION_NONE;
312 }
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000313 /* Scroll bar */
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000314 else
315 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000316 int nb_lines = viewport_get_nb_lines(&list_text[screen]);
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000317 if (nb_lines < gui_list->nb_items)
318 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000319 int scrollbar_size = nb_lines*
320 font_get(gui_list->parent[screen]->font)->height;
321 int actual_y = y - list_text[screen].y;
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000322
Jonathan Gordone385ee12008-12-31 05:59:26 +0000323 int new_selection = (actual_y * gui_list->nb_items)
324 / scrollbar_size;
Maurus Cuelenaere475c2e72008-06-28 23:48:37 +0000325
326 int start_item = new_selection - nb_lines/2;
327 if(start_item < 0)
328 start_item = 0;
329 else if(start_item > gui_list->nb_items - nb_lines)
330 start_item = gui_list->nb_items - nb_lines;
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000331
Jonathan Gordone385ee12008-12-31 05:59:26 +0000332 gui_list->start_item[screen] = start_item;
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000333 gui_synclist_select_item(gui_list, new_selection);
Maurus Cuelenaere475c2e72008-06-28 23:48:37 +0000334
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000335 return ACTION_REDRAW;
336 }
337 }
338 }
339 else
340 {
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000341 /* |--------------------------------------------------------|
342 * | Description of the touchscreen list interface: |
343 * |--------------------------------------------------------|
344 * | Pressing an item will select it and "enter" it. |
345 * | |
346 * | Pressing and holding your pen down will scroll through |
Maurus Cuelenaere75cac2c2008-06-02 18:59:32 +0000347 * | the list of items. |
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000348 * | |
349 * | Pressing and holding your pen down on a single item |
350 * | will bring up the context menu of it. |
351 * |--------------------------------------------------------|
352 */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000353 if (y > list_text[screen].y)
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000354 {
Maurus Cuelenaere4bbdc5c2008-06-06 18:44:59 +0000355 int line_height, actual_y;
Maurus Cuelenaere475c2e72008-06-28 23:48:37 +0000356 static int last_y = 0;
Maurus Cuelenaeree1753de2008-06-06 18:29:46 +0000357
Jonathan Gordone385ee12008-12-31 05:59:26 +0000358 actual_y = y - list_text[screen].y;
359 line_height = font_get(gui_list->parent[screen]->font)->height;
Maurus Cuelenaeree1753de2008-06-06 18:29:46 +0000360 line = actual_y / line_height;
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000361
Maurus Cuelenaeree1753de2008-06-06 18:29:46 +0000362 if(actual_y%line_height == 0) /* Pressed a border */
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000363 return ACTION_NONE;
Maurus Cuelenaere3d240f12008-06-28 20:11:51 +0000364
Jonathan Gordone385ee12008-12-31 05:59:26 +0000365 if (gui_list->start_item[screen]+line > gui_list->nb_items)
366 {
367 /* Pressed below the list*/
Maurus Cuelenaere3d240f12008-06-28 20:11:51 +0000368 return ACTION_NONE;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000369 }
Maurus Cuelenaere475c2e72008-06-28 23:48:37 +0000370 last_y = actual_y;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000371 if (line != gui_list->selected_item
372 - gui_list->start_item[screen] && button ^ BUTTON_REL)
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000373 {
Maurus Cuelenaere75cac2c2008-06-02 18:59:32 +0000374 if(button & BUTTON_REPEAT)
375 scrolling = true;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000376 gui_synclist_select_item(gui_list, gui_list->start_item[screen]
377 + line);
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000378 return ACTION_REDRAW;
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000379 }
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000380
Maurus Cuelenaere5dca53e2008-06-01 13:56:34 +0000381 if (button == (BUTTON_REPEAT|BUTTON_REL))
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000382 {
Maurus Cuelenaere75cac2c2008-06-02 18:59:32 +0000383 if(!scrolling)
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000384 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000385 /* Pen was hold on the same line as the
386 * previously selected one
387 * => simulate long button press
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000388 */
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000389 return ACTION_STD_CONTEXT;
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000390 }
391 else
392 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000393 /* Pen was moved across several lines and then released on
394 * this one
395 * => do nothing
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000396 */
Maurus Cuelenaere75cac2c2008-06-02 18:59:32 +0000397 scrolling = false;
398 return ACTION_NONE;
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000399 }
400 }
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000401 else if(button == BUTTON_REL)
402 {
Jonathan Gordone385ee12008-12-31 05:59:26 +0000403 /* Pen was released on either the same line as the previously
404 * selected one or an other one
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000405 * => simulate short press
406 */
407 return ACTION_STD_OK;
408 }
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000409 else
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000410 return ACTION_NONE;
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000411 }
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000412 /* Title goes up one level (only on BUTTON_REL&~BUTTON_REPEAT) */
Jonathan Gordone385ee12008-12-31 05:59:26 +0000413 else if (y > title_text[screen].y && draw_title(display, gui_list)
414 && button == BUTTON_REL)
415 {
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000416 return ACTION_STD_CANCEL;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000417 }
Maurus Cuelenaerecad30d32008-06-02 16:08:01 +0000418 /* Title or statusbar is cancel (only on BUTTON_REL&~BUTTON_REPEAT) */
Maurus Cuelenaere944219b2008-05-30 22:55:24 +0000419 else if (global_settings.statusbar && button == BUTTON_REL)
Jonathan Gordone385ee12008-12-31 05:59:26 +0000420 {
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000421 return ACTION_STD_CANCEL;
Jonathan Gordone385ee12008-12-31 05:59:26 +0000422 }
Jonathan Gordonf444f1e2008-03-05 10:38:10 +0000423 }
424 return ACTION_NONE;
425}
426#endif