summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/action.h28
-rw-r--r--apps/bookmark.c2
-rw-r--r--apps/debug_menu.c2
-rw-r--r--apps/main_menu.c7
-rw-r--r--apps/menu.c122
-rw-r--r--apps/menu.h9
-rw-r--r--apps/onplay.c4
-rw-r--r--apps/playlist_menu.c2
-rw-r--r--apps/playlist_viewer.c4
-rw-r--r--apps/recorder/radio.c6
-rw-r--r--apps/screens.c271
-rw-r--r--apps/screens.h3
-rw-r--r--apps/settings_menu.c32
-rw-r--r--apps/sound_menu.c4
-rw-r--r--apps/tree.c5
-rw-r--r--apps/wps.c5
-rw-r--r--docs/CREDITS1
17 files changed, 310 insertions, 197 deletions
diff --git a/apps/action.h b/apps/action.h
new file mode 100644
index 0000000000..ef17185df2
--- /dev/null
+++ b/apps/action.h
@@ -0,0 +1,28 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2004 Brent Coutts
10 *
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
13 *
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
16 *
17 ****************************************************************************/
18#ifndef __ACTION_H__
19#define __ACTION_H__
20
21#include "stdbool.h"
22
23#define CONTEXT_WPS 1
24#define CONTEXT_TREE 2
25#define CONTEXT_RECORD 3
26#define CONTEXT_MAINMENU 4
27
28#endif
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 5ecd10e6ce..51b720bf32 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -98,7 +98,7 @@ bool bookmark_menu(void)
98 { str(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), bookmark_mrb_load}, 98 { str(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), bookmark_mrb_load},
99 }; 99 };
100 100
101 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 101 m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL );
102 102
103#ifdef HAVE_LCD_CHARCELLS 103#ifdef HAVE_LCD_CHARCELLS
104 status_set_param(true); 104 status_set_param(true);
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index a2535d7f54..b77014a846 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1509,7 +1509,7 @@ bool debug_menu(void)
1509#endif 1509#endif
1510 }; 1510 };
1511 1511
1512 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 1512 m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL );
1513 result = menu_run(m); 1513 result = menu_run(m);
1514 menu_exit(m); 1514 menu_exit(m);
1515 1515
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 23af8d7817..f42655b0c2 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -254,6 +254,7 @@ static bool recording_settings(void)
254#endif 254#endif
255 255
256#ifdef HAVE_MAS3587F 256#ifdef HAVE_MAS3587F
257
257bool rec_menu(void) 258bool rec_menu(void)
258{ 259{
259 int m; 260 int m;
@@ -265,7 +266,7 @@ bool rec_menu(void)
265 { str(LANG_RECORDING_SETTINGS), recording_settings}, 266 { str(LANG_RECORDING_SETTINGS), recording_settings},
266 }; 267 };
267 268
268 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 269 m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL );
269 result = menu_run(m); 270 result = menu_run(m);
270 menu_exit(m); 271 menu_exit(m);
271 272
@@ -290,7 +291,7 @@ bool info_menu(void)
290#endif 291#endif
291 }; 292 };
292 293
293 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 294 m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL );
294 result = menu_run(m); 295 result = menu_run(m);
295 menu_exit(m); 296 menu_exit(m);
296 297
@@ -336,7 +337,7 @@ bool main_menu(void)
336 items[i].desc = str(LANG_INFO); 337 items[i].desc = str(LANG_INFO);
337 items[i++].function = info_menu; 338 items[i++].function = info_menu;
338 339
339 m=menu_init( items, i ); 340 m=menu_init( items, i, NULL );
340#ifdef HAVE_LCD_CHARCELLS 341#ifdef HAVE_LCD_CHARCELLS
341 status_set_param(true); 342 status_set_param(true);
342#endif 343#endif
diff --git a/apps/menu.c b/apps/menu.c
index 0bd21b9108..f187b5d82b 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -17,6 +17,7 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include <stdbool.h> 19#include <stdbool.h>
20#include <stdlib.h>
20 21
21#include "hwcompat.h" 22#include "hwcompat.h"
22#include "lcd.h" 23#include "lcd.h"
@@ -42,6 +43,7 @@ struct menu {
42 int cursor; 43 int cursor;
43 struct menu_items* items; 44 struct menu_items* items;
44 int itemcount; 45 int itemcount;
46 int (*callback)(int, int);
45}; 47};
46 48
47#define MAX_MENUS 5 49#define MAX_MENUS 5
@@ -123,7 +125,7 @@ void put_cursorxy(int x, int y, bool on)
123 } 125 }
124} 126}
125 127
126static void menu_draw(int m) 128void menu_draw(int m)
127{ 129{
128 int i = 0; 130 int i = 0;
129#ifdef HAVE_LCD_BITMAP 131#ifdef HAVE_LCD_BITMAP
@@ -216,7 +218,7 @@ static void put_cursor(int m, int target)
216 218
217} 219}
218 220
219int menu_init(struct menu_items* mitems, int count) 221int menu_init(struct menu_items* mitems, int count, int (*callback)(int, int))
220{ 222{
221 int i; 223 int i;
222 224
@@ -234,6 +236,7 @@ int menu_init(struct menu_items* mitems, int count)
234 menus[i].itemcount = count; 236 menus[i].itemcount = count;
235 menus[i].top = 0; 237 menus[i].top = 0;
236 menus[i].cursor = 0; 238 menus[i].cursor = 0;
239 menus[i].callback = callback;
237 240
238 return i; 241 return i;
239} 242}
@@ -246,6 +249,7 @@ void menu_exit(int m)
246int menu_show(int m) 249int menu_show(int m)
247{ 250{
248 bool exit = false; 251 bool exit = false;
252 int key;
249#ifdef HAVE_LCD_BITMAP 253#ifdef HAVE_LCD_BITMAP
250 int fw, fh; 254 int fw, fh;
251 int menu_lines; 255 int menu_lines;
@@ -260,7 +264,16 @@ int menu_show(int m)
260 menu_draw(m); 264 menu_draw(m);
261 265
262 while (!exit) { 266 while (!exit) {
263 switch( button_get_w_tmo(HZ/2) ) { 267 key = button_get_w_tmo(HZ/2);
268
269 /*
270 * "short-circuit" the default keypresses by running the callback function
271 */
272
273 if( menus[m].callback != NULL )
274 key = menus[m].callback(key, m); /* make sure there's no match in the switch */
275
276 switch( key ) {
264#ifdef HAVE_RECORDER_KEYPAD 277#ifdef HAVE_RECORDER_KEYPAD
265 case BUTTON_UP: 278 case BUTTON_UP:
266 case BUTTON_UP | BUTTON_REPEAT: 279 case BUTTON_UP | BUTTON_REPEAT:
@@ -326,20 +339,6 @@ int menu_show(int m)
326 exit = true; 339 exit = true;
327 break; 340 break;
328 341
329#ifdef HAVE_RECORDER_KEYPAD
330 case BUTTON_F2:
331 if (f2_screen())
332 return MENU_ATTACHED_USB;
333 menu_draw(m);
334 break;
335
336 case BUTTON_F3:
337 if (f3_screen())
338 return MENU_ATTACHED_USB;
339 menu_draw(m);
340 break;
341#endif
342
343 case SYS_USB_CONNECTED: 342 case SYS_USB_CONNECTED:
344 usb_screen(); 343 usb_screen();
345#ifdef HAVE_LCD_CHARCELLS 344#ifdef HAVE_LCD_CHARCELLS
@@ -369,3 +368,92 @@ bool menu_run(int m)
369 } 368 }
370 return false; 369 return false;
371} 370}
371
372/*
373 * Property function - return the current cursor for "menu"
374 */
375
376int menu_cursor(int menu)
377{
378 return menus[menu].cursor;
379}
380
381/*
382 * Property function - return the "menu" description at "position"
383 */
384
385char* menu_description(int menu, int position)
386{
387 return menus[menu].items[position].desc;
388}
389
390/*
391 * Delete the element "position" from the menu items in "menu"
392 */
393
394void menu_delete(int menu, int position)
395{
396 int i;
397
398 /* copy the menu item from the one below */
399 for( i = position; i < (menus[menu].itemcount - 1); i++)
400 menus[menu].items[i] = menus[menu].items[i + 1];
401
402 /* reduce the count */
403 menus[menu].itemcount--;
404
405 /* adjust if this was the last menu item and the cursor was on it */
406 if( menus[menu].itemcount <= menus[menu].cursor)
407 menus[menu].cursor = menus[menu].itemcount - 1;
408}
409
410/*
411 * Property function - return the "count" of menu items in "menu"
412 */
413
414int menu_count(int menu)
415{
416 return menus[menu].itemcount;
417}
418
419/*
420 * Allows a menu item at the current cursor position in "menu" to be moved up the list
421 */
422
423bool menu_moveup(int menu)
424{
425 struct menu_items swap;
426
427 /* can't be the first item ! */
428 if( menus[menu].cursor == 0)
429 return false;
430
431 /* use a temporary variable to do the swap */
432 swap = menus[menu].items[menus[menu].cursor - 1];
433 menus[menu].items[menus[menu].cursor - 1] = menus[menu].items[menus[menu].cursor];
434 menus[menu].items[menus[menu].cursor] = swap;
435 menus[menu].cursor--;
436
437 return true;
438}
439
440/*
441 * Allows a menu item at the current cursor position in "menu" to be moved down the list
442 */
443
444bool menu_movedown(int menu)
445{
446 struct menu_items swap;
447
448 /* can't be the last item ! */
449 if( menus[menu].cursor == menus[menu].itemcount - 1)
450 return false;
451
452 /* use a temporary variable to do the swap */
453 swap = menus[menu].items[menus[menu].cursor + 1];
454 menus[menu].items[menus[menu].cursor + 1] = menus[menu].items[menus[menu].cursor];
455 menus[menu].items[menus[menu].cursor] = swap;
456 menus[menu].cursor++;
457
458 return true;
459}
diff --git a/apps/menu.h b/apps/menu.h
index 632db87e4b..827de1da36 100644
--- a/apps/menu.h
+++ b/apps/menu.h
@@ -27,7 +27,7 @@ struct menu_items {
27 bool (*function) (void); /* return true if USB was connected */ 27 bool (*function) (void); /* return true if USB was connected */
28}; 28};
29 29
30int menu_init(struct menu_items* items, int count); 30int menu_init(struct menu_items* items, int count, int (*callback) (int keycode, int menu));
31void menu_exit(int menu); 31void menu_exit(int menu);
32 32
33void put_cursorxy(int x, int y, bool on); 33void put_cursorxy(int x, int y, bool on);
@@ -38,6 +38,13 @@ int menu_show(int m);
38#define MENU_SELECTED_EXIT -2 38#define MENU_SELECTED_EXIT -2
39 39
40bool menu_run(int menu); 40bool menu_run(int menu);
41int menu_cursor(int menu);
42char* menu_description(int menu, int position);
43void menu_delete(int menu, int position);
44int menu_count(int menu);
45bool menu_moveup(int menu);
46bool menu_movedown(int menu);
47void menu_draw(int menu);
41 48
42#endif /* End __MENU_H__ */ 49#endif /* End __MENU_H__ */
43 50
diff --git a/apps/onplay.c b/apps/onplay.c
index 52d5d20c6e..e4733fba53 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -193,7 +193,7 @@ static bool playlist_options(void)
193 i++; 193 i++;
194 } 194 }
195 195
196 m = menu_init( menu, i ); 196 m = menu_init( menu, i, NULL );
197 result = menu_show(m); 197 result = menu_show(m);
198 if (result >= 0 && result < pstart) 198 if (result >= 0 && result < pstart)
199 ret = menu[result].function(); 199 ret = menu[result].function();
@@ -580,7 +580,7 @@ int onplay(char* file, int attr)
580 i++; 580 i++;
581 581
582 /* DIY menu handling, since we want to exit after selection */ 582 /* DIY menu handling, since we want to exit after selection */
583 m = menu_init( menu, i ); 583 m = menu_init( menu, i, NULL );
584 result = menu_show(m); 584 result = menu_show(m);
585 if (result >= 0) 585 if (result >= 0)
586 menu[result].function(); 586 menu[result].function();
diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c
index b2742781a1..87862ab252 100644
--- a/apps/playlist_menu.c
+++ b/apps/playlist_menu.c
@@ -71,7 +71,7 @@ bool playlist_menu(void)
71 { str(LANG_RECURSE_DIRECTORY), recurse_directory }, 71 { str(LANG_RECURSE_DIRECTORY), recurse_directory },
72 }; 72 };
73 73
74 m = menu_init( items, sizeof items / sizeof(struct menu_items) ); 74 m = menu_init( items, sizeof items / sizeof(struct menu_items), NULL );
75 result = menu_run(m); 75 result = menu_run(m);
76 menu_exit(m); 76 menu_exit(m);
77 return result; 77 return result;
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index f469cc328e..58052afd6b 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -693,7 +693,7 @@ static int onplay_menu(int index)
693 menu[i].desc = str(LANG_FILE_OPTIONS); 693 menu[i].desc = str(LANG_FILE_OPTIONS);
694 i++; 694 i++;
695 695
696 m = menu_init(menu, i); 696 m = menu_init(menu, i, NULL);
697 result = menu_show(m); 697 result = menu_show(m);
698 if (result == MENU_ATTACHED_USB) 698 if (result == MENU_ATTACHED_USB)
699 ret = -1; 699 ret = -1;
@@ -763,7 +763,7 @@ static bool viewer_menu(void)
763 { str(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, 763 { str(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
764 }; 764 };
765 765
766 m=menu_init( items, sizeof(items) / sizeof(*items) ); 766 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
767 result = menu_run(m); 767 result = menu_run(m);
768 menu_exit(m); 768 menu_exit(m);
769 769
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index fdb1f1bbf7..a9937a3f60 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -604,7 +604,7 @@ bool radio_preset_select(void)
604 if(num_presets) 604 if(num_presets)
605 { 605 {
606 /* DIY menu handling, since we want to exit after selection */ 606 /* DIY menu handling, since we want to exit after selection */
607 m = menu_init( menu, num_presets ); 607 m = menu_init( menu, num_presets, NULL );
608 result = menu_show(m); 608 result = menu_show(m);
609 menu_exit(m); 609 menu_exit(m);
610 if (result == MENU_SELECTED_EXIT) 610 if (result == MENU_SELECTED_EXIT)
@@ -676,7 +676,7 @@ bool radio_delete_preset(void)
676 } 676 }
677 677
678 /* DIY menu handling, since we want to exit after selection */ 678 /* DIY menu handling, since we want to exit after selection */
679 m = menu_init( menu, num_presets ); 679 m = menu_init( menu, num_presets, NULL );
680 result = menu_show(m); 680 result = menu_show(m);
681 menu_exit(m); 681 menu_exit(m);
682 if (result == MENU_SELECTED_EXIT) 682 if (result == MENU_SELECTED_EXIT)
@@ -724,7 +724,7 @@ bool radio_menu(void)
724 bool result; 724 bool result;
725 725
726 m = menu_init( radio_menu_items, 726 m = menu_init( radio_menu_items,
727 sizeof radio_menu_items / sizeof(struct menu_items) ); 727 sizeof radio_menu_items / sizeof(struct menu_items), NULL );
728 result = menu_run(m); 728 result = menu_run(m);
729 menu_exit(m); 729 menu_exit(m);
730 return result; 730 return result;
diff --git a/apps/screens.c b/apps/screens.c
index 6987fc92e3..c2320a0217 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -37,6 +37,7 @@
37#include "system.h" 37#include "system.h"
38#include "powermgmt.h" 38#include "powermgmt.h"
39#include "adc.h" 39#include "adc.h"
40#include "action.h"
40 41
41#ifdef HAVE_LCD_BITMAP 42#ifdef HAVE_LCD_BITMAP
42#define BMPHEIGHT_usb_logo 32 43#define BMPHEIGHT_usb_logo 32
@@ -427,85 +428,128 @@ int on_screen(void)
427 return 0; 428 return 0;
428} 429}
429 430
430bool f2_screen(void) 431bool quick_screen(int context, int button)
431{ 432{
432 bool exit = false; 433 bool exit = false;
433 bool used = false; 434 bool used = false;
434 int w, h; 435 int w, h, key;
435 char buf[32]; 436 char buf[32];
436 int oldrepeat = global_settings.repeat_mode; 437 int oldrepeat = global_settings.repeat_mode;
437 438
439 /* just to stop compiler warning */
440 context = context;
438 lcd_setfont(FONT_SYSFIXED); 441 lcd_setfont(FONT_SYSFIXED);
439 lcd_getstringsize("A",&w,&h); 442
443 if(button==BUTTON_F2)
444 lcd_getstringsize("A",&w,&h);
440 445
441 while (!exit) { 446 while (!exit) {
442 char* ptr=NULL; 447 char* ptr=NULL;
443 448
444 lcd_clear_display(); 449 lcd_clear_display();
445 450
446 /* Shuffle mode */ 451 switch(button)
447 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE)); 452 {
448 lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); 453 case BUTTON_F2:
449 lcd_putsxy(0, LCD_HEIGHT/2, 454 /* Shuffle mode */
450 global_settings.playlist_shuffle ? 455 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE));
451 str(LANG_ON) : str(LANG_OFF)); 456 lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
452 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], 457 lcd_putsxy(0, LCD_HEIGHT/2,
453 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); 458 global_settings.playlist_shuffle ?
454 459 str(LANG_ON) : str(LANG_OFF));
455 /* Directory Filter */ 460
456 switch ( global_settings.dirfilter ) { 461 /* Directory Filter */
457 case SHOW_ALL: 462 switch ( global_settings.dirfilter ) {
458 ptr = str(LANG_FILTER_ALL); 463 case SHOW_ALL:
459 break; 464 ptr = str(LANG_FILTER_ALL);
460 465 break;
461 case SHOW_SUPPORTED: 466
462 ptr = str(LANG_FILTER_SUPPORTED); 467 case SHOW_SUPPORTED:
463 break; 468 ptr = str(LANG_FILTER_SUPPORTED);
464 469 break;
465 case SHOW_MUSIC: 470
466 ptr = str(LANG_FILTER_MUSIC); 471 case SHOW_MUSIC:
472 ptr = str(LANG_FILTER_MUSIC);
473 break;
474
475 case SHOW_PLAYLIST:
476 ptr = str(LANG_FILTER_PLAYLIST);
477 break;
478 }
479
480 snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER));
481 lcd_getstringsize(buf,&w,&h);
482 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf);
483 lcd_getstringsize(ptr,&w,&h);
484 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
485
486 /* Repeat Mode */
487 switch ( global_settings.repeat_mode ) {
488 case REPEAT_OFF:
489 ptr = str(LANG_OFF);
490 break;
491
492 case REPEAT_ALL:
493 ptr = str(LANG_REPEAT_ALL);
494 break;
495
496 case REPEAT_ONE:
497 ptr = str(LANG_REPEAT_ONE);
498 break;
499 }
500
501 lcd_getstringsize(str(LANG_REPEAT),&w,&h);
502 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, str(LANG_REPEAT));
503 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
504 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr);
467 break; 505 break;
468 506 case BUTTON_F3:
469 case SHOW_PLAYLIST: 507 /* Scrollbar */
470 ptr = str(LANG_FILTER_PLAYLIST); 508 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL));
509 lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
510 lcd_putsxy(0, LCD_HEIGHT/2,
511 global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF));
512
513 /* Status bar */
514 ptr = str(LANG_F3_STATUS);
515 lcd_getstringsize(ptr,&w,&h);
516 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr);
517 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
518 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2,
519 global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF));
520
521 /* Flip */
522 ptr = str(LANG_FLIP_DISPLAY);
523 lcd_getstringsize(ptr,&w,&h);
524 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, str(LANG_FLIP_DISPLAY));
525 ptr = global_settings.flip_display ?
526 str(LANG_SET_BOOL_YES) : str(LANG_SET_BOOL_NO);
527 lcd_getstringsize(ptr,&w,&h);
528 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
471 break; 529 break;
472 } 530 }
473 531
474 snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER)); 532 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
475 lcd_getstringsize(buf,&w,&h); 533 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
476 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf);
477 lcd_getstringsize(ptr,&w,&h);
478 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
479 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], 534 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
480 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); 535 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
481
482 /* Repeat Mode */
483 switch ( global_settings.repeat_mode ) {
484 case REPEAT_OFF:
485 ptr = str(LANG_OFF);
486 break;
487
488 case REPEAT_ALL:
489 ptr = str(LANG_REPEAT_ALL);
490 break;
491
492 case REPEAT_ONE:
493 ptr = str(LANG_REPEAT_ONE);
494 break;
495 }
496
497 lcd_getstringsize(str(LANG_REPEAT),&w,&h);
498 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, str(LANG_REPEAT));
499 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
500 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr);
501 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], 536 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
502 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true); 537 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
503 538
504 lcd_update(); 539 lcd_update();
505 540 key = button_get(true);
506 switch (button_get(true)) { 541
507 case BUTTON_LEFT: 542 /*
543 * This is a temporary kludge so that the F2 & F3 menus operate in exactly
544 * the same manner up until the full F2/F3 configurable menus are complete
545 */
546
547 if( key == BUTTON_LEFT || key == BUTTON_RIGHT || key == BUTTON_DOWN || key == ( BUTTON_LEFT | BUTTON_REPEAT ) || key == ( BUTTON_RIGHT | BUTTON_REPEAT ) || key == ( BUTTON_DOWN | BUTTON_REPEAT ) )
548 key = button | key;
549
550 switch (key) {
508 case BUTTON_F2 | BUTTON_LEFT: 551 case BUTTON_F2 | BUTTON_LEFT:
552 case BUTTON_F2 | BUTTON_LEFT | BUTTON_REPEAT:
509 global_settings.playlist_shuffle = 553 global_settings.playlist_shuffle =
510 !global_settings.playlist_shuffle; 554 !global_settings.playlist_shuffle;
511 555
@@ -519,110 +563,38 @@ bool f2_screen(void)
519 used = true; 563 used = true;
520 break; 564 break;
521 565
522 case BUTTON_DOWN:
523 case BUTTON_F2 | BUTTON_DOWN: 566 case BUTTON_F2 | BUTTON_DOWN:
567 case BUTTON_F2 | BUTTON_DOWN | BUTTON_REPEAT:
524 global_settings.dirfilter++; 568 global_settings.dirfilter++;
525 if ( global_settings.dirfilter >= NUM_FILTER_MODES ) 569 if ( global_settings.dirfilter >= NUM_FILTER_MODES )
526 global_settings.dirfilter = 0; 570 global_settings.dirfilter = 0;
527 used = true; 571 used = true;
528 break; 572 break;
529 573
530 case BUTTON_RIGHT:
531 case BUTTON_F2 | BUTTON_RIGHT: 574 case BUTTON_F2 | BUTTON_RIGHT:
575 case BUTTON_F2 | BUTTON_RIGHT | BUTTON_REPEAT:
532 global_settings.repeat_mode++; 576 global_settings.repeat_mode++;
533 if ( global_settings.repeat_mode >= NUM_REPEAT_MODES ) 577 if ( global_settings.repeat_mode >= NUM_REPEAT_MODES )
534 global_settings.repeat_mode = 0; 578 global_settings.repeat_mode = 0;
535 used = true; 579 used = true;
536 break; 580 break;
537 581
538 case BUTTON_F2 | BUTTON_REL:
539 if ( used )
540 exit = true;
541 used = true;
542 break;
543
544 case BUTTON_F2 | BUTTON_REPEAT:
545 used = true;
546 break;
547
548 case BUTTON_OFF | BUTTON_REPEAT:
549 return false;
550
551 case SYS_USB_CONNECTED:
552 usb_screen();
553 return true;
554 }
555 }
556
557 settings_save();
558 lcd_setfont(FONT_UI);
559 if ( oldrepeat != global_settings.repeat_mode )
560 mpeg_flush_and_reload_tracks();
561
562 return false;
563}
564
565bool f3_screen(void)
566{
567 bool exit = false;
568 bool used = false;
569
570 lcd_setfont(FONT_SYSFIXED);
571
572 while (!exit) {
573 int w,h;
574 char* ptr;
575
576 lcd_clear_display();
577
578 /* Scrollbar */
579 lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL));
580 lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
581 lcd_putsxy(0, LCD_HEIGHT/2,
582 global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF));
583 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
584 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
585
586 /* Status bar */
587 ptr = str(LANG_F3_STATUS);
588 lcd_getstringsize(ptr,&w,&h);
589 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr);
590 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
591 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2,
592 global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF));
593 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
594 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
595
596 /* Flip */
597 ptr = str(LANG_FLIP_DISPLAY);
598 lcd_getstringsize(ptr,&w,&h);
599 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, str(LANG_FLIP_DISPLAY));
600 ptr = global_settings.flip_display ?
601 str(LANG_SET_BOOL_YES) : str(LANG_SET_BOOL_NO);
602 lcd_getstringsize(ptr,&w,&h);
603 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
604 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
605 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
606
607 lcd_update();
608
609 switch (button_get(true)) {
610 case BUTTON_LEFT:
611 case BUTTON_F3 | BUTTON_LEFT: 582 case BUTTON_F3 | BUTTON_LEFT:
583 case BUTTON_F3 | BUTTON_LEFT | BUTTON_REPEAT:
612 global_settings.scrollbar = !global_settings.scrollbar; 584 global_settings.scrollbar = !global_settings.scrollbar;
613 used = true; 585 used = true;
614 break; 586 break;
615 587
616 case BUTTON_RIGHT:
617 case BUTTON_F3 | BUTTON_RIGHT: 588 case BUTTON_F3 | BUTTON_RIGHT:
589 case BUTTON_F3 | BUTTON_RIGHT | BUTTON_REPEAT:
618 global_settings.statusbar = !global_settings.statusbar; 590 global_settings.statusbar = !global_settings.statusbar;
619 used = true; 591 used = true;
620 break; 592 break;
621 593
622 case BUTTON_DOWN:
623 case BUTTON_F3 | BUTTON_DOWN: 594 case BUTTON_F3 | BUTTON_DOWN:
624 case BUTTON_UP: /* allow "up" as well, more tolerant if tilted */ 595 case BUTTON_F3 | BUTTON_DOWN | BUTTON_REPEAT:
625 case BUTTON_F3 | BUTTON_UP: 596 case BUTTON_F3 | BUTTON_UP:
597 case BUTTON_F3 | BUTTON_UP | BUTTON_REPEAT:
626 global_settings.flip_display = !global_settings.flip_display; 598 global_settings.flip_display = !global_settings.flip_display;
627 button_set_flip(global_settings.flip_display); 599 button_set_flip(global_settings.flip_display);
628 lcd_set_flip(global_settings.flip_display); 600 lcd_set_flip(global_settings.flip_display);
@@ -630,13 +602,13 @@ bool f3_screen(void)
630 break; 602 break;
631 603
632 case BUTTON_F3 | BUTTON_REL: 604 case BUTTON_F3 | BUTTON_REL:
633 if ( used ) 605 case BUTTON_F2 | BUTTON_REL:
606
607 if( used )
634 exit = true; 608 exit = true;
635 used = true;
636 break;
637 609
638 case BUTTON_F3 | BUTTON_REPEAT:
639 used = true; 610 used = true;
611
640 break; 612 break;
641 613
642 case BUTTON_OFF | BUTTON_REPEAT: 614 case BUTTON_OFF | BUTTON_REPEAT:
@@ -649,10 +621,25 @@ bool f3_screen(void)
649 } 621 }
650 622
651 settings_save(); 623 settings_save();
652 if (global_settings.statusbar) 624
653 lcd_setmargins(0, STATUSBAR_HEIGHT); 625 switch( button )
654 else 626 {
655 lcd_setmargins(0, 0); 627 case BUTTON_F2:
628
629 if ( oldrepeat != global_settings.repeat_mode )
630 mpeg_flush_and_reload_tracks();
631
632 break;
633 case BUTTON_F3:
634
635 if (global_settings.statusbar)
636 lcd_setmargins(0, STATUSBAR_HEIGHT);
637 else
638 lcd_setmargins(0, 0);
639
640 break;
641 }
642
656 lcd_setfont(FONT_UI); 643 lcd_setfont(FONT_UI);
657 644
658 return false; 645 return false;
diff --git a/apps/screens.h b/apps/screens.h
index fdd5df1c68..2fa081a272 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -26,8 +26,7 @@ void charging_splash(void);
26 26
27#ifdef HAVE_RECORDER_KEYPAD 27#ifdef HAVE_RECORDER_KEYPAD
28int on_screen(void); 28int on_screen(void);
29bool f2_screen(void); 29bool quick_screen(const int, const int);
30bool f3_screen(void);
31#endif 30#endif
32 31
33void splash(int ticks, /* how long */ 32void splash(int ticks, /* how long */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 24a67adc47..7c060c4533 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -380,7 +380,7 @@ static bool peak_meter_menu(void)
380 { str(LANG_PM_MAX) , peak_meter_max }, 380 { str(LANG_PM_MAX) , peak_meter_max },
381 }; 381 };
382 382
383 m=menu_init( items, sizeof(items) / sizeof(*items) ); 383 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
384 result = menu_run(m); 384 result = menu_run(m);
385 menu_exit(m); 385 menu_exit(m);
386 return result; 386 return result;
@@ -795,7 +795,7 @@ static bool ff_rewind_settings_menu(void)
795 { str(LANG_FFRW_ACCEL), ff_rewind_accel }, 795 { str(LANG_FFRW_ACCEL), ff_rewind_accel },
796 }; 796 };
797 797
798 m=menu_init( items, sizeof(items) / sizeof(*items) ); 798 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
799 result = menu_run(m); 799 result = menu_run(m);
800 menu_exit(m); 800 menu_exit(m);
801 801
@@ -819,7 +819,7 @@ static bool playback_settings_menu(void)
819 819
820 bool old_shuffle = global_settings.playlist_shuffle; 820 bool old_shuffle = global_settings.playlist_shuffle;
821 821
822 m=menu_init( items, sizeof(items) / sizeof(*items) ); 822 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
823 result = menu_run(m); 823 result = menu_run(m);
824 menu_exit(m); 824 menu_exit(m);
825 825
@@ -848,7 +848,7 @@ static bool bookmark_settings_menu(void)
848 { str(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS), useMRB}, 848 { str(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS), useMRB},
849 }; 849 };
850 850
851 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 851 m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL );
852 result = menu_run(m); 852 result = menu_run(m);
853 menu_exit(m); 853 menu_exit(m);
854 854
@@ -916,7 +916,7 @@ static bool fileview_settings_menu(void)
916 { str(LANG_SHOW_ICONS), show_icons }, 916 { str(LANG_SHOW_ICONS), show_icons },
917 }; 917 };
918 918
919 m=menu_init( items, sizeof(items) / sizeof(*items) ); 919 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
920 result = menu_run(m); 920 result = menu_run(m);
921 menu_exit(m); 921 menu_exit(m);
922 return result; 922 return result;
@@ -941,7 +941,7 @@ static bool scroll_settings_menu(void)
941#endif 941#endif
942 }; 942 };
943 943
944 m=menu_init( items, sizeof(items) / sizeof(*items) ); 944 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
945 result = menu_run(m); 945 result = menu_run(m);
946 menu_exit(m); 946 menu_exit(m);
947 return result; 947 return result;
@@ -964,7 +964,7 @@ static bool lcd_settings_menu(void)
964#endif 964#endif
965 }; 965 };
966 966
967 m=menu_init( items, sizeof(items) / sizeof(*items) ); 967 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
968 result = menu_run(m); 968 result = menu_run(m);
969 menu_exit(m); 969 menu_exit(m);
970 return result; 970 return result;
@@ -983,7 +983,7 @@ static bool bars_settings_menu(void)
983 { str(LANG_BATTERY_DISPLAY), battery_type }, 983 { str(LANG_BATTERY_DISPLAY), battery_type },
984 }; 984 };
985 985
986 m=menu_init( items, sizeof(items) / sizeof(*items) ); 986 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
987 result = menu_run(m); 987 result = menu_run(m);
988 menu_exit(m); 988 menu_exit(m);
989 return result; 989 return result;
@@ -1009,7 +1009,7 @@ static bool display_settings_menu(void)
1009#endif 1009#endif
1010 }; 1010 };
1011 1011
1012 m=menu_init( items, sizeof(items) / sizeof(*items) ); 1012 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
1013 result = menu_run(m); 1013 result = menu_run(m);
1014 menu_exit(m); 1014 menu_exit(m);
1015 return result; 1015 return result;
@@ -1036,7 +1036,7 @@ static bool battery_settings_menu(void)
1036#endif 1036#endif
1037 }; 1037 };
1038 1038
1039 m=menu_init( items, sizeof(items) / sizeof(*items) ); 1039 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
1040 result = menu_run(m); 1040 result = menu_run(m);
1041 menu_exit(m); 1041 menu_exit(m);
1042 return result; 1042 return result;
@@ -1054,7 +1054,7 @@ static bool disk_settings_menu(void)
1054#endif 1054#endif
1055 }; 1055 };
1056 1056
1057 m=menu_init( items, sizeof(items) / sizeof(*items) ); 1057 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
1058 result = menu_run(m); 1058 result = menu_run(m);
1059 menu_exit(m); 1059 menu_exit(m);
1060 return result; 1060 return result;
@@ -1071,7 +1071,7 @@ static bool time_settings_menu(void)
1071 { str(LANG_TIMEFORMAT), timeformat_set }, 1071 { str(LANG_TIMEFORMAT), timeformat_set },
1072 }; 1072 };
1073 1073
1074 m=menu_init( items, sizeof(items) / sizeof(*items) ); 1074 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
1075 result = menu_run(m); 1075 result = menu_run(m);
1076 menu_exit(m); 1076 menu_exit(m);
1077 return result; 1077 return result;
@@ -1090,7 +1090,7 @@ static bool manage_settings_menu(void)
1090 { str(LANG_SAVE_SETTINGS), settings_save_config }, 1090 { str(LANG_SAVE_SETTINGS), settings_save_config },
1091 }; 1091 };
1092 1092
1093 m=menu_init( items, sizeof(items) / sizeof(*items) ); 1093 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
1094 result = menu_run(m); 1094 result = menu_run(m);
1095 menu_exit(m); 1095 menu_exit(m);
1096 return result; 1096 return result;
@@ -1106,7 +1106,7 @@ static bool limits_settings_menu(void)
1106 { str(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist }, 1106 { str(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist },
1107 }; 1107 };
1108 1108
1109 m=menu_init( items, sizeof(items) / sizeof(*items) ); 1109 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
1110 result = menu_run(m); 1110 result = menu_run(m);
1111 menu_exit(m); 1111 menu_exit(m);
1112 return result; 1112 return result;
@@ -1137,7 +1137,7 @@ static bool system_settings_menu(void)
1137 { str(LANG_MANAGE_MENU), manage_settings_menu }, 1137 { str(LANG_MANAGE_MENU), manage_settings_menu },
1138 }; 1138 };
1139 1139
1140 m=menu_init( items, sizeof(items) / sizeof(*items) ); 1140 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
1141 result = menu_run(m); 1141 result = menu_run(m);
1142 menu_exit(m); 1142 menu_exit(m);
1143 return result; 1143 return result;
@@ -1157,7 +1157,7 @@ bool settings_menu(void)
1157 { str(LANG_LANGUAGE), language_browse }, 1157 { str(LANG_LANGUAGE), language_browse },
1158 }; 1158 };
1159 1159
1160 m=menu_init( items, sizeof(items) / sizeof(*items) ); 1160 m=menu_init( items, sizeof(items) / sizeof(*items), NULL );
1161 result = menu_run(m); 1161 result = menu_run(m);
1162 menu_exit(m); 1162 menu_exit(m);
1163 return result; 1163 return result;
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index 01bbe09bd1..256da0b81a 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -307,7 +307,7 @@ bool sound_menu(void)
307#endif 307#endif
308 }; 308 };
309 309
310 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 310 m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL );
311 result = menu_run(m); 311 result = menu_run(m);
312 menu_exit(m); 312 menu_exit(m);
313 313
@@ -341,7 +341,7 @@ bool recording_menu(bool no_source)
341 menu[i].desc = str(LANG_RECORD_DIRECTORY); 341 menu[i].desc = str(LANG_RECORD_DIRECTORY);
342 menu[i++].function = recdirectory; 342 menu[i++].function = recdirectory;
343 343
344 m=menu_init( menu, i ); 344 m=menu_init( menu, i, NULL );
345 result = menu_run(m); 345 result = menu_run(m);
346 menu_exit(m); 346 menu_exit(m);
347 347
diff --git a/apps/tree.c b/apps/tree.c
index 88fb2f3ab0..7a7ba3a2f9 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -54,6 +54,7 @@
54#include "buffer.h" 54#include "buffer.h"
55#include "plugin.h" 55#include "plugin.h"
56#include "power.h" 56#include "power.h"
57#include "action.h"
57 58
58#ifdef HAVE_LCD_BITMAP 59#ifdef HAVE_LCD_BITMAP
59#include "widgets.h" 60#include "widgets.h"
@@ -1277,7 +1278,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1277 case BUTTON_F2: 1278 case BUTTON_F2:
1278 if (*dirfilter < NUM_FILTER_MODES) 1279 if (*dirfilter < NUM_FILTER_MODES)
1279 { 1280 {
1280 if (f2_screen()) 1281 if (quick_screen(CONTEXT_TREE, BUTTON_F2))
1281 reload_root = true; 1282 reload_root = true;
1282 restore = true; 1283 restore = true;
1283 break; 1284 break;
@@ -1286,7 +1287,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1286 case BUTTON_F3: 1287 case BUTTON_F3:
1287 if (*dirfilter < NUM_FILTER_MODES) 1288 if (*dirfilter < NUM_FILTER_MODES)
1288 { 1289 {
1289 if (f3_screen()) 1290 if (quick_screen(CONTEXT_TREE, BUTTON_F3))
1290 reload_root = true; 1291 reload_root = true;
1291 1292
1292#ifdef HAVE_LCD_BITMAP 1293#ifdef HAVE_LCD_BITMAP
diff --git a/apps/wps.c b/apps/wps.c
index f1c1adc7fd..e1a2bab722 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -43,6 +43,7 @@
43#ifdef HAVE_LCD_BITMAP 43#ifdef HAVE_LCD_BITMAP
44#include "icons.h" 44#include "icons.h"
45#include "peakmeter.h" 45#include "peakmeter.h"
46#include "action.h"
46#endif 47#endif
47#include "lang.h" 48#include "lang.h"
48#include "bookmark.h" 49#include "bookmark.h"
@@ -926,14 +927,14 @@ int wps_show(void)
926#ifdef HAVE_RECORDER_KEYPAD 927#ifdef HAVE_RECORDER_KEYPAD
927 /* play settings */ 928 /* play settings */
928 case BUTTON_F2: 929 case BUTTON_F2:
929 if (f2_screen()) 930 if (quick_screen(CONTEXT_WPS, BUTTON_F2))
930 return SYS_USB_CONNECTED; 931 return SYS_USB_CONNECTED;
931 restore = true; 932 restore = true;
932 break; 933 break;
933 934
934 /* screen settings */ 935 /* screen settings */
935 case BUTTON_F3: 936 case BUTTON_F3:
936 if (f3_screen()) 937 if (quick_screen(CONTEXT_WPS, BUTTON_F2))
937 return SYS_USB_CONNECTED; 938 return SYS_USB_CONNECTED;
938 restore = true; 939 restore = true;
939 break; 940 break;
diff --git a/docs/CREDITS b/docs/CREDITS
index b05f6c99bb..8affb939c8 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -83,3 +83,4 @@ Lee Pilgrim
83Zakk Roberts 83Zakk Roberts
84Francois Boucher 84Francois Boucher
85Matthias Wientapper 85Matthias Wientapper
86Brent Coutts