Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2007 by Jonathan Gordon |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 12 | * 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 Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 16 | * |
| 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 Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 39 | #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 | |
Bertrik Sikken | db2d61f | 2008-04-20 10:24:15 +0000 | [diff] [blame] | 48 | static struct viewport title_text[NB_SCREENS], title_icons[NB_SCREENS], |
| 49 | list_text[NB_SCREENS], list_icons[NB_SCREENS]; |
Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 50 | |
| 51 | /* should probably be moved somewhere else */ |
| 52 | int list_title_height(struct gui_synclist *list, struct viewport *vp) |
| 53 | { |
| 54 | (void)list; |
| 55 | return font_get(vp->font)->height; |
| 56 | } |
| 57 | int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width, |
| 58 | int text_pos, struct screen * display, |
| 59 | struct viewport *vp); |
| 60 | bool list_display_title(struct gui_synclist *list, struct viewport *vp); |
| 61 | |
| 62 | /* Draw the list... |
| 63 | internal screen layout: |
| 64 | ----------------- |
| 65 | |TI| title | TI is title icon |
| 66 | ----------------- |
| 67 | | | | | |
| 68 | |S|I| | S - scrollbar |
| 69 | | | | items | I - icons |
| 70 | | | | | |
| 71 | ------------------ |
| 72 | */ |
| 73 | static bool draw_title(struct screen *display, struct viewport *parent, |
| 74 | struct gui_synclist *list) |
| 75 | { |
| 76 | struct viewport *vp_icons = &title_icons[display->screen_type]; |
| 77 | struct viewport *vp_text = &title_text[display->screen_type]; |
| 78 | if (!list_display_title(list, parent)) |
| 79 | return false; |
| 80 | *vp_text = *parent; |
| 81 | vp_text->height = list_title_height(list, parent); |
| 82 | if (list->title_icon != Icon_NOICON && global_settings.show_icons) |
| 83 | { |
| 84 | *vp_icons = *vp_text; |
| 85 | vp_icons->width = get_icon_width(display->screen_type) |
| 86 | + ICON_PADDING*2; |
| 87 | vp_icons->x += ICON_PADDING; |
| 88 | |
| 89 | vp_text->width -= vp_icons->width + vp_icons->x; |
| 90 | vp_text->x += vp_icons->width + vp_icons->x; |
| 91 | |
| 92 | display->set_viewport(vp_icons); |
| 93 | screen_put_icon(display, 0, 0, list->title_icon); |
| 94 | } |
| 95 | display->set_viewport(vp_text); |
| 96 | vp_text->drawmode = STYLE_DEFAULT; |
| 97 | #ifdef HAVE_LCD_COLOR |
| 98 | if (list->title_color >= 0) |
| 99 | { |
| 100 | vp_text->drawmode |= (STYLE_COLORED|list->title_color);} |
| 101 | #endif |
| 102 | display->puts_scroll_style_offset(0, 0, list->title, |
| 103 | vp_text->drawmode, 0); |
| 104 | return true; |
| 105 | } |
| 106 | |
| 107 | void list_draw(struct screen *display, struct viewport *parent, |
| 108 | struct gui_synclist *list) |
| 109 | { |
| 110 | int start, end, line_height, i; |
| 111 | int icon_width = get_icon_width(display->screen_type) + ICON_PADDING; |
| 112 | bool show_cursor = !global_settings.cursor_style && |
| 113 | list->show_selection_marker; |
| 114 | #ifdef HAVE_LCD_COLOR |
| 115 | unsigned char cur_line = 0; |
| 116 | #endif |
| 117 | int item_offset; |
| 118 | bool show_title; |
| 119 | line_height = font_get(parent->font)->height; |
| 120 | display->set_viewport(parent); |
| 121 | display->clear_viewport(); |
| 122 | display->stop_scroll(); |
| 123 | list_text[display->screen_type] = *parent; |
| 124 | if ((show_title = draw_title(display, parent, list))) |
| 125 | { |
| 126 | list_text[display->screen_type].y += list_title_height(list, parent); |
| 127 | list_text[display->screen_type].height -= list_title_height(list, parent); |
| 128 | } |
| 129 | |
| 130 | start = list->start_item[display->screen_type]; |
| 131 | end = start + viewport_get_nb_lines(&list_text[display->screen_type]); |
| 132 | |
| 133 | /* draw the scrollbar if its needed */ |
| 134 | if (global_settings.scrollbar && |
| 135 | viewport_get_nb_lines(&list_text[display->screen_type]) < list->nb_items) |
| 136 | { |
| 137 | struct viewport vp; |
| 138 | vp = list_text[display->screen_type]; |
| 139 | vp.width = SCROLLBAR_WIDTH; |
| 140 | list_text[display->screen_type].width -= SCROLLBAR_WIDTH; |
| 141 | list_text[display->screen_type].x += SCROLLBAR_WIDTH; |
| 142 | vp.height = line_height * |
| 143 | viewport_get_nb_lines(&list_text[display->screen_type]); |
| 144 | vp.x = parent->x; |
| 145 | display->set_viewport(&vp); |
| 146 | gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, |
| 147 | vp.height, list->nb_items, |
| 148 | list->start_item[display->screen_type], |
| 149 | list->start_item[display->screen_type] + end-start, |
| 150 | VERTICAL); |
| 151 | } |
| 152 | else if (show_title) |
| 153 | { |
| 154 | /* shift everything right a bit... */ |
| 155 | list_text[display->screen_type].width -= SCROLLBAR_WIDTH; |
| 156 | list_text[display->screen_type].x += SCROLLBAR_WIDTH; |
| 157 | } |
| 158 | |
| 159 | /* setup icon placement */ |
| 160 | list_icons[display->screen_type] = list_text[display->screen_type]; |
| 161 | int icon_count = global_settings.show_icons && |
| 162 | (list->callback_get_item_icon != NULL) ? 1 : 0; |
| 163 | if (show_cursor) |
| 164 | icon_count++; |
| 165 | if (icon_count) |
| 166 | { |
| 167 | list_icons[display->screen_type].width = icon_width * icon_count; |
| 168 | list_text[display->screen_type].width -= |
| 169 | list_icons[display->screen_type].width + ICON_PADDING; |
| 170 | list_text[display->screen_type].x += |
| 171 | list_icons[display->screen_type].width + ICON_PADDING; |
| 172 | } |
| 173 | |
| 174 | for (i=start; i<end && i<list->nb_items; i++) |
| 175 | { |
| 176 | /* do the text */ |
| 177 | unsigned char *s; |
| 178 | char entry_buffer[MAX_PATH]; |
| 179 | unsigned char *entry_name; |
| 180 | int text_pos = 0; |
Nils Wallménius | 6848961 | 2008-04-09 15:25:17 +0000 | [diff] [blame] | 181 | s = list->callback_get_item_name(i, list->data, entry_buffer, |
| 182 | sizeof(entry_buffer)); |
Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 183 | entry_name = P2STR(s); |
| 184 | display->set_viewport(&list_text[display->screen_type]); |
| 185 | list_text[display->screen_type].drawmode = STYLE_DEFAULT; |
| 186 | /* position the string at the correct offset place */ |
| 187 | int item_width,h; |
| 188 | display->getstringsize(entry_name, &item_width, &h); |
| 189 | item_offset = gui_list_get_item_offset(list, item_width, |
| 190 | text_pos, display, |
| 191 | &list_text[display->screen_type]); |
| 192 | |
| 193 | #ifdef HAVE_LCD_COLOR |
| 194 | /* if the list has a color callback */ |
| 195 | if (list->callback_get_item_color) |
| 196 | { |
| 197 | int color = list->callback_get_item_color(i, list->data); |
| 198 | /* if color selected */ |
| 199 | if (color >= 0) |
| 200 | { |
| 201 | list_text[display->screen_type].drawmode |= STYLE_COLORED|color; |
| 202 | } |
| 203 | } |
| 204 | #endif |
Jonathan Gordon | 34196ed | 2008-04-03 04:41:42 +0000 | [diff] [blame] | 205 | if(i >= list->selected_item && |
Jonathan Gordon | f818196 | 2008-04-21 13:44:52 +0000 | [diff] [blame] | 206 | i < list->selected_item + list->selected_size && list->show_selection_marker) |
Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 207 | {/* The selected item must be displayed scrolling */ |
Jonathan Gordon | 34196ed | 2008-04-03 04:41:42 +0000 | [diff] [blame] | 208 | if (global_settings.cursor_style == 1 |
| 209 | #ifdef HAVE_REMOTE_LCD |
| 210 | /* the global_settings.cursor_style check is here to make sure |
| 211 | if they want the cursor instead of bar it will work */ |
| 212 | || (display->depth < 16 && global_settings.cursor_style) |
| 213 | #endif |
| 214 | ) |
Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 215 | { |
| 216 | /* Display inverted-line-style */ |
Jonathan Gordon | 5c416ae | 2008-06-15 13:12:26 +0000 | [diff] [blame] | 217 | list_text[display->screen_type].drawmode = STYLE_INVERT; |
Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 218 | } |
| 219 | #ifdef HAVE_LCD_COLOR |
| 220 | else if (global_settings.cursor_style == 2) |
| 221 | { |
| 222 | /* Display colour line selector */ |
Jonathan Gordon | 5c416ae | 2008-06-15 13:12:26 +0000 | [diff] [blame] | 223 | list_text[display->screen_type].drawmode = STYLE_COLORBAR; |
Jonathan Gordon | 0e5cec2 | 2008-03-05 09:58:30 +0000 | [diff] [blame] | 224 | } |
| 225 | else if (global_settings.cursor_style == 3) |
| 226 | { |
| 227 | /* Display gradient line selector */ |
| 228 | list_text[display->screen_type].drawmode = STYLE_GRADIENT; |
| 229 | |
| 230 | /* Make the lcd driver know how many lines the gradient should |
| 231 | cover and current line number */ |
| 232 | /* number of selected lines */ |
| 233 | list_text[display->screen_type].drawmode |= NUMLN_PACK(list->selected_size); |
| 234 | /* current line number, zero based */ |
| 235 | list_text[display->screen_type].drawmode |= CURLN_PACK(cur_line); |
| 236 | cur_line++; |
| 237 | } |
| 238 | #endif |
| 239 | /* if the text is smaller than the viewport size */ |
| 240 | if (item_offset > item_width - (list_text[display->screen_type].width - text_pos)) |
| 241 | { |
| 242 | /* don't scroll */ |
| 243 | display->puts_style_offset(0, i-start, entry_name, |
| 244 | list_text[display->screen_type].drawmode, item_offset); |
| 245 | } |
| 246 | else |
| 247 | { |
| 248 | display->puts_scroll_style_offset(0, i-start, entry_name, |
| 249 | list_text[display->screen_type].drawmode, item_offset); |
| 250 | } |
| 251 | } |
| 252 | else |
| 253 | display->puts_style_offset(0, i-start, entry_name, |
| 254 | list_text[display->screen_type].drawmode, item_offset); |
| 255 | /* do the icon */ |
| 256 | if (list->callback_get_item_icon && global_settings.show_icons) |
| 257 | { |
| 258 | display->set_viewport(&list_icons[display->screen_type]); |
| 259 | screen_put_icon_with_offset(display, show_cursor?1:0, |
| 260 | (i-start),show_cursor?ICON_PADDING:0,0, |
| 261 | list->callback_get_item_icon(i, list->data)); |
| 262 | if (show_cursor && i >= list->selected_item && |
| 263 | i < list->selected_item + list->selected_size) |
| 264 | { |
| 265 | screen_put_icon(display, 0, i-start, Icon_Cursor); |
| 266 | } |
| 267 | } |
| 268 | else if (show_cursor && i >= list->selected_item && |
| 269 | i < list->selected_item + list->selected_size) |
| 270 | { |
| 271 | display->set_viewport(&list_icons[display->screen_type]); |
| 272 | screen_put_icon(display, 0, (i-start), Icon_Cursor); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | display->set_viewport(parent); |
| 277 | display->update_viewport(); |
| 278 | display->set_viewport(NULL); |
| 279 | } |
| 280 | |
| 281 | |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 282 | #if defined(HAVE_TOUCHPAD) |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 283 | /* This needs to be fixed if we ever get more than 1 touchscreen on a target. |
| 284 | * This also assumes the whole screen is used, which is a bad assumption but |
| 285 | * fine until customizable lists comes in... |
| 286 | */ |
Maurus Cuelenaere | 75cac2c | 2008-06-02 18:59:32 +0000 | [diff] [blame] | 287 | static bool scrolling=false; |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 288 | |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 289 | unsigned gui_synclist_do_touchpad(struct gui_synclist * gui_list, struct viewport *parent) |
| 290 | { |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 291 | short x, y; |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 292 | unsigned button = action_get_touchpad_press(&x, &y); |
| 293 | int line; |
| 294 | struct screen *display = &screens[SCREEN_MAIN]; |
| 295 | if (button == BUTTON_NONE) |
| 296 | return ACTION_NONE; |
| 297 | if (x<list_text[SCREEN_MAIN].x) |
| 298 | { |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 299 | /* Top left corner is hopefully GO_TO_ROOT */ |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 300 | if (y<list_text[SCREEN_MAIN].y) |
| 301 | { |
| 302 | if (button == BUTTON_REL) |
| 303 | return ACTION_STD_MENU; |
Maurus Cuelenaere | 5dca53e | 2008-06-01 13:56:34 +0000 | [diff] [blame] | 304 | else if (button == (BUTTON_REPEAT|BUTTON_REL)) |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 305 | return ACTION_STD_CONTEXT; |
| 306 | else |
| 307 | return ACTION_NONE; |
| 308 | } |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 309 | /* Scroll bar */ |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 310 | else |
| 311 | { |
| 312 | int new_selection, nb_lines; |
| 313 | int height, size; |
| 314 | nb_lines = viewport_get_nb_lines(&list_text[SCREEN_MAIN]); |
| 315 | if (nb_lines < gui_list->nb_items) |
| 316 | { |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 317 | height = nb_lines * font_get(parent->font)->height; |
Maurus Cuelenaere | 995b71a | 2008-06-01 13:37:33 +0000 | [diff] [blame] | 318 | size = height / gui_list->nb_items; |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 319 | new_selection = ((y-list_text[SCREEN_MAIN].y)*(gui_list->nb_items-nb_lines))/(height-size); |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 320 | |
Maurus Cuelenaere | 995b71a | 2008-06-01 13:37:33 +0000 | [diff] [blame] | 321 | if (new_selection - gui_list->start_item[SCREEN_MAIN] > (nb_lines/2)) |
| 322 | new_selection = gui_list->start_item[SCREEN_MAIN]+(nb_lines/2); |
| 323 | else if (new_selection > gui_list->nb_items-nb_lines) |
| 324 | new_selection = gui_list->nb_items-nb_lines; |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 325 | |
| 326 | gui_synclist_select_item(gui_list, new_selection); |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 327 | gui_list->start_item[SCREEN_MAIN] = new_selection; |
| 328 | return ACTION_REDRAW; |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | else |
| 333 | { |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 334 | /* |--------------------------------------------------------| |
| 335 | * | Description of the touchscreen list interface: | |
| 336 | * |--------------------------------------------------------| |
| 337 | * | Pressing an item will select it and "enter" it. | |
| 338 | * | | |
| 339 | * | Pressing and holding your pen down will scroll through | |
Maurus Cuelenaere | 75cac2c | 2008-06-02 18:59:32 +0000 | [diff] [blame] | 340 | * | the list of items. | |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 341 | * | | |
| 342 | * | Pressing and holding your pen down on a single item | |
| 343 | * | will bring up the context menu of it. | |
| 344 | * |--------------------------------------------------------| |
| 345 | */ |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 346 | if (y > list_text[SCREEN_MAIN].y) |
| 347 | { |
Maurus Cuelenaere | 4bbdc5c | 2008-06-06 18:44:59 +0000 | [diff] [blame] | 348 | int line_height, actual_y; |
Maurus Cuelenaere | e1753de | 2008-06-06 18:29:46 +0000 | [diff] [blame] | 349 | |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 350 | actual_y = y - list_text[SCREEN_MAIN].y; |
| 351 | line_height = font_get(parent->font)->height; |
Maurus Cuelenaere | e1753de | 2008-06-06 18:29:46 +0000 | [diff] [blame] | 352 | line = actual_y / line_height; |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 353 | |
Maurus Cuelenaere | e1753de | 2008-06-06 18:29:46 +0000 | [diff] [blame] | 354 | if(actual_y%line_height == 0) /* Pressed a border */ |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 355 | return ACTION_NONE; |
| 356 | |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 357 | if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN] && button ^ BUTTON_REL) |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 358 | { |
| 359 | if (gui_list->start_item[SCREEN_MAIN]+line > gui_list->nb_items) |
| 360 | return ACTION_NONE; |
Maurus Cuelenaere | 75cac2c | 2008-06-02 18:59:32 +0000 | [diff] [blame] | 361 | if(button & BUTTON_REPEAT) |
| 362 | scrolling = true; |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 363 | gui_synclist_select_item(gui_list, gui_list->start_item[SCREEN_MAIN]+line); |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 364 | return ACTION_REDRAW; |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 365 | } |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 366 | |
Maurus Cuelenaere | 5dca53e | 2008-06-01 13:56:34 +0000 | [diff] [blame] | 367 | if (button == (BUTTON_REPEAT|BUTTON_REL)) |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 368 | { |
Maurus Cuelenaere | 75cac2c | 2008-06-02 18:59:32 +0000 | [diff] [blame] | 369 | if(!scrolling) |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 370 | { |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 371 | /* Pen was hold on the same line as the previously selected one |
| 372 | * => simulate long button press |
| 373 | */ |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 374 | return ACTION_STD_CONTEXT; |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 375 | } |
| 376 | else |
| 377 | { |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 378 | /* Pen was moved across several lines and then released on this one |
Maurus Cuelenaere | 75cac2c | 2008-06-02 18:59:32 +0000 | [diff] [blame] | 379 | * => do nothing |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 380 | */ |
Maurus Cuelenaere | 75cac2c | 2008-06-02 18:59:32 +0000 | [diff] [blame] | 381 | scrolling = false; |
| 382 | return ACTION_NONE; |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 383 | } |
| 384 | } |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 385 | else if(button == BUTTON_REL) |
| 386 | { |
| 387 | /* Pen was released on either the same line as the previously selected one |
| 388 | * or an other one |
| 389 | * => simulate short press |
| 390 | */ |
| 391 | return ACTION_STD_OK; |
| 392 | } |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 393 | else |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 394 | return ACTION_NONE; |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 395 | } |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 396 | /* Title goes up one level (only on BUTTON_REL&~BUTTON_REPEAT) */ |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 397 | else if (y > title_text[SCREEN_MAIN].y && draw_title(display, parent, gui_list) && button == BUTTON_REL) |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 398 | return ACTION_STD_CANCEL; |
Maurus Cuelenaere | cad30d3 | 2008-06-02 16:08:01 +0000 | [diff] [blame] | 399 | /* Title or statusbar is cancel (only on BUTTON_REL&~BUTTON_REPEAT) */ |
Maurus Cuelenaere | 944219b | 2008-05-30 22:55:24 +0000 | [diff] [blame] | 400 | else if (global_settings.statusbar && button == BUTTON_REL) |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 401 | return ACTION_STD_CANCEL; |
Jonathan Gordon | f444f1e | 2008-03-05 10:38:10 +0000 | [diff] [blame] | 402 | } |
| 403 | return ACTION_NONE; |
| 404 | } |
| 405 | #endif |