diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-06-16 04:25:21 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-06-16 04:25:21 +0000 |
commit | af9f4056510f248c4c9c1335167853bb455e8cc0 (patch) | |
tree | eff7ad7726083ee605d753bd9aa9e22213b1acf0 /apps/plugins/viewer.c | |
parent | cb57a568e8dc9def607dc9ab27f515309bd13841 (diff) | |
download | rockbox-af9f4056510f248c4c9c1335167853bb455e8cc0.tar.gz rockbox-af9f4056510f248c4c9c1335167853bb455e8cc0.zip |
Accept FS#10094 by Teruaki Kawashima:
Replace the old menu API with the "new" one (a very long time overdue so huge thanks for the work.)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21306 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/viewer.c')
-rw-r--r-- | apps/plugins/viewer.c | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index e17033fcd1..e3d0903d01 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include <ctype.h> | 23 | #include <ctype.h> |
24 | #include "lib/playback_control.h" | 24 | #include "lib/playback_control.h" |
25 | #include "lib/oldmenuapi.h" | ||
26 | 25 | ||
27 | PLUGIN_HEADER | 26 | PLUGIN_HEADER |
28 | 27 | ||
@@ -1448,30 +1447,37 @@ static bool autoscroll_speed_setting(void) | |||
1448 | &prefs.autoscroll_speed, NULL, 1, 1, 10, NULL); | 1447 | &prefs.autoscroll_speed, NULL, 1, 1, 10, NULL); |
1449 | } | 1448 | } |
1450 | 1449 | ||
1450 | MENUITEM_FUNCTION(encoding_item, 0, "Encoding", encoding_setting, | ||
1451 | NULL, NULL, Icon_NOICON); | ||
1452 | MENUITEM_FUNCTION(word_wrap_item, 0, "Word Wrap", word_wrap_setting, | ||
1453 | NULL, NULL, Icon_NOICON); | ||
1454 | MENUITEM_FUNCTION(line_mode_item, 0, "Line Mode", line_mode_setting, | ||
1455 | NULL, NULL, Icon_NOICON); | ||
1456 | MENUITEM_FUNCTION(view_mode_item, 0, "Wide View", view_mode_setting, | ||
1457 | NULL, NULL, Icon_NOICON); | ||
1458 | #ifdef HAVE_LCD_BITMAP | ||
1459 | MENUITEM_FUNCTION(scrollbar_item, 0, "Show Scrollbar", scrollbar_setting, | ||
1460 | NULL, NULL, Icon_NOICON); | ||
1461 | MENUITEM_FUNCTION(page_mode_item, 0, "Overlap Pages", page_mode_setting, | ||
1462 | NULL, NULL, Icon_NOICON); | ||
1463 | #endif | ||
1464 | MENUITEM_FUNCTION(scroll_mode_item, 0, "Scroll Mode", scroll_mode_setting, | ||
1465 | NULL, NULL, Icon_NOICON); | ||
1466 | MENUITEM_FUNCTION(autoscroll_speed_item, 0, "Auto-Scroll Speed", | ||
1467 | autoscroll_speed_setting, NULL, NULL, Icon_NOICON); | ||
1468 | MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON, | ||
1469 | &encoding_item, &word_wrap_item, &line_mode_item, &view_mode_item, | ||
1470 | #ifdef HAVE_LCD_BITMAP | ||
1471 | &scrollbar_item, &page_mode_item, | ||
1472 | #endif | ||
1473 | &scroll_mode_item, &autoscroll_speed_item); | ||
1474 | |||
1451 | static bool viewer_options_menu(void) | 1475 | static bool viewer_options_menu(void) |
1452 | { | 1476 | { |
1453 | int m; | ||
1454 | bool result; | 1477 | bool result; |
1478 | result = (rb->do_menu(&option_menu, NULL, NULL, false) == MENU_ATTACHED_USB); | ||
1455 | 1479 | ||
1456 | static const struct menu_item items[] = { | ||
1457 | {"Encoding", encoding_setting }, | ||
1458 | {"Word Wrap", word_wrap_setting }, | ||
1459 | {"Line Mode", line_mode_setting }, | ||
1460 | {"Wide View", view_mode_setting }, | ||
1461 | #ifdef HAVE_LCD_BITMAP | 1480 | #ifdef HAVE_LCD_BITMAP |
1462 | {"Show Scrollbar", scrollbar_setting }, | ||
1463 | {"Overlap Pages", page_mode_setting }, | ||
1464 | #endif | ||
1465 | {"Scroll Mode", scroll_mode_setting}, | ||
1466 | {"Auto-Scroll Speed", autoscroll_speed_setting }, | ||
1467 | }; | ||
1468 | m = menu_init(items, sizeof(items) / sizeof(*items), | ||
1469 | NULL, NULL, NULL, NULL); | ||
1470 | |||
1471 | result = menu_run(m); | ||
1472 | menu_exit(m); | ||
1473 | #ifdef HAVE_LCD_BITMAP | ||
1474 | |||
1475 | /* Show-scrollbar mode for current view-width mode */ | 1481 | /* Show-scrollbar mode for current view-width mode */ |
1476 | init_need_scrollbar(); | 1482 | init_need_scrollbar(); |
1477 | #endif | 1483 | #endif |
@@ -1480,23 +1486,15 @@ static bool viewer_options_menu(void) | |||
1480 | 1486 | ||
1481 | static void viewer_menu(void) | 1487 | static void viewer_menu(void) |
1482 | { | 1488 | { |
1483 | int m; | ||
1484 | int result; | 1489 | int result; |
1485 | static const struct menu_item items[] = { | 1490 | MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL, |
1486 | {"Quit", NULL }, | 1491 | "Return", "Viewer Options", |
1487 | {"Viewer Options", NULL }, | 1492 | "Show Playback Menu", "Quit"); |
1488 | {"Show Playback Menu", NULL }, | ||
1489 | {"Return", NULL }, | ||
1490 | }; | ||
1491 | 1493 | ||
1492 | m = menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); | 1494 | result = rb->do_menu(&menu, NULL, NULL, false); |
1493 | result=menu_show(m); | ||
1494 | switch (result) | 1495 | switch (result) |
1495 | { | 1496 | { |
1496 | case 0: /* quit */ | 1497 | case 0: /* return */ |
1497 | menu_exit(m); | ||
1498 | viewer_exit(NULL); | ||
1499 | done = true; | ||
1500 | break; | 1498 | break; |
1501 | case 1: /* change settings */ | 1499 | case 1: /* change settings */ |
1502 | done = viewer_options_menu(); | 1500 | done = viewer_options_menu(); |
@@ -1504,10 +1502,11 @@ static void viewer_menu(void) | |||
1504 | case 2: /* playback control */ | 1502 | case 2: /* playback control */ |
1505 | playback_control(NULL); | 1503 | playback_control(NULL); |
1506 | break; | 1504 | break; |
1507 | case 3: /* return */ | 1505 | case 3: /* quit */ |
1506 | viewer_exit(NULL); | ||
1507 | done = true; | ||
1508 | break; | 1508 | break; |
1509 | } | 1509 | } |
1510 | menu_exit(m); | ||
1511 | viewer_draw(col); | 1510 | viewer_draw(col); |
1512 | } | 1511 | } |
1513 | 1512 | ||