diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-12-31 05:59:26 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-12-31 05:59:26 +0000 |
commit | e385ee18ce501e26189d5a2a68d092104720df30 (patch) | |
tree | 5219051887835d9750d80f71d9849ceb3aa65d82 | |
parent | 54919ae9176bd9cbffc8412f0c831f471b8ac4d5 (diff) | |
download | rockbox-e385ee18ce501e26189d5a2a68d092104720df30.tar.gz rockbox-e385ee18ce501e26189d5a2a68d092104720df30.zip |
Decouple the statusbar drawing from the rest of the screen drawing. it is not drawn roughly 4x per second automatically.
viewport_Set_defaults() will setup the given viewport with the correct "full screen" dimensions (so start at 0,0 if statusbars are disabled or 0,8 if they are enabled.)
All screens should keep the statusbar enabled, but if you really want to ignore the user setting you can disbaled it with viewportmanager_set_statusbar(false).
This commit also includes some menu/list viewport cleanups from kugel in FS#9603
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19622 a1c6a512-1295-4272-9138-f99709370657
46 files changed, 294 insertions, 264 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c index bc058b7251..3c3ed3de39 100644 --- a/apps/alarm_menu.c +++ b/apps/alarm_menu.c | |||
@@ -193,7 +193,6 @@ bool alarm_screen(void) | |||
193 | break; | 193 | break; |
194 | 194 | ||
195 | case ACTION_NONE: | 195 | case ACTION_NONE: |
196 | gui_syncstatusbar_draw(&statusbars, false); | ||
197 | hour_wrapped = false; | 196 | hour_wrapped = false; |
198 | break; | 197 | break; |
199 | 198 | ||
diff --git a/apps/appevents.h b/apps/appevents.h index 36990f9768..48d578de25 100644 --- a/apps/appevents.h +++ b/apps/appevents.h | |||
@@ -49,6 +49,7 @@ enum { | |||
49 | enum { | 49 | enum { |
50 | GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1), | 50 | GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1), |
51 | GUI_EVENT_STATUSBAR_TOGGLE, | 51 | GUI_EVENT_STATUSBAR_TOGGLE, |
52 | GUI_EVENT_FOURHERTZ, | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | #endif | 55 | #endif |
diff --git a/apps/bookmark.c b/apps/bookmark.c index 524de5aff4..52599519a3 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -198,7 +198,6 @@ bool bookmark_autobookmark(void) | |||
198 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | 198 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 |
199 | show_remote_main_backdrop(); | 199 | show_remote_main_backdrop(); |
200 | #endif | 200 | #endif |
201 | gui_syncstatusbar_draw(&statusbars, false); | ||
202 | if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) | 201 | if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) |
203 | { | 202 | { |
204 | if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) | 203 | if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) |
@@ -680,11 +679,9 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu | |||
680 | gui_synclist_set_voice_callback(&list, bookmark_list_voice_cb); | 679 | gui_synclist_set_voice_callback(&list, bookmark_list_voice_cb); |
681 | gui_synclist_set_title(&list, str(LANG_BOOKMARK_SELECT_BOOKMARK), | 680 | gui_synclist_set_title(&list, str(LANG_BOOKMARK_SELECT_BOOKMARK), |
682 | Icon_Bookmark); | 681 | Icon_Bookmark); |
683 | gui_syncstatusbar_draw(&statusbars, true); | ||
684 | 682 | ||
685 | while (!exit) | 683 | while (!exit) |
686 | { | 684 | { |
687 | gui_syncstatusbar_draw(&statusbars, false); | ||
688 | 685 | ||
689 | if (refresh) | 686 | if (refresh) |
690 | { | 687 | { |
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 8878e29c3a..92eb245249 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "misc.h" | 47 | #include "misc.h" |
48 | #include "splash.h" | 48 | #include "splash.h" |
49 | #include "dircache.h" | 49 | #include "dircache.h" |
50 | #include "viewport.h" | ||
50 | #ifdef HAVE_TAGCACHE | 51 | #ifdef HAVE_TAGCACHE |
51 | #include "tagcache.h" | 52 | #include "tagcache.h" |
52 | #endif | 53 | #endif |
@@ -232,6 +233,7 @@ static bool dbg_audio_thread(void) | |||
232 | struct audio_debug d; | 233 | struct audio_debug d; |
233 | 234 | ||
234 | lcd_setfont(FONT_SYSFIXED); | 235 | lcd_setfont(FONT_SYSFIXED); |
236 | viewportmanager_set_statusbar(false); | ||
235 | 237 | ||
236 | while(1) | 238 | while(1) |
237 | { | 239 | { |
@@ -269,6 +271,7 @@ static bool dbg_audio_thread(void) | |||
269 | 271 | ||
270 | lcd_update(); | 272 | lcd_update(); |
271 | } | 273 | } |
274 | viewportmanager_set_statusbar(true); | ||
272 | return false; | 275 | return false; |
273 | } | 276 | } |
274 | #endif /* !SIMULATOR */ | 277 | #endif /* !SIMULATOR */ |
@@ -304,6 +307,7 @@ static bool dbg_buffering_thread(void) | |||
304 | tick_add_task(dbg_audio_task); | 307 | tick_add_task(dbg_audio_task); |
305 | 308 | ||
306 | lcd_setfont(FONT_SYSFIXED); | 309 | lcd_setfont(FONT_SYSFIXED); |
310 | viewportmanager_set_statusbar(false); | ||
307 | while(!done) | 311 | while(!done) |
308 | { | 312 | { |
309 | button = get_action(CONTEXT_STD,HZ/5); | 313 | button = get_action(CONTEXT_STD,HZ/5); |
@@ -394,6 +398,7 @@ static bool dbg_buffering_thread(void) | |||
394 | } | 398 | } |
395 | 399 | ||
396 | tick_remove_task(dbg_audio_task); | 400 | tick_remove_task(dbg_audio_task); |
401 | viewportmanager_set_statusbar(true); | ||
397 | 402 | ||
398 | return false; | 403 | return false; |
399 | } | 404 | } |
@@ -526,6 +531,7 @@ static bool dbg_hw_info(void) | |||
526 | 531 | ||
527 | lcd_setfont(FONT_SYSFIXED); | 532 | lcd_setfont(FONT_SYSFIXED); |
528 | lcd_clear_display(); | 533 | lcd_clear_display(); |
534 | viewportmanager_set_statusbar(false); | ||
529 | 535 | ||
530 | lcd_puts(0, 0, "[Hardware info]"); | 536 | lcd_puts(0, 0, "[Hardware info]"); |
531 | 537 | ||
@@ -564,6 +570,7 @@ static bool dbg_hw_info(void) | |||
564 | int got_id; /* flag if we managed to get the flash IDs */ | 570 | int got_id; /* flag if we managed to get the flash IDs */ |
565 | int oldmode; /* saved memory guard mode */ | 571 | int oldmode; /* saved memory guard mode */ |
566 | int line = 0; | 572 | int line = 0; |
573 | viewportmanager_set_statusbar(false); | ||
567 | 574 | ||
568 | oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */ | 575 | oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */ |
569 | 576 | ||
@@ -626,6 +633,7 @@ static bool dbg_hw_info(void) | |||
626 | 633 | ||
627 | lcd_setfont(FONT_SYSFIXED); | 634 | lcd_setfont(FONT_SYSFIXED); |
628 | lcd_clear_display(); | 635 | lcd_clear_display(); |
636 | viewportmanager_set_statusbar(false); | ||
629 | 637 | ||
630 | lcd_puts(0, line++, "[Hardware info]"); | 638 | lcd_puts(0, line++, "[Hardware info]"); |
631 | 639 | ||
@@ -679,10 +687,12 @@ static bool dbg_hw_info(void) | |||
679 | lcd_update(); | 687 | lcd_update(); |
680 | 688 | ||
681 | while (!(action_userabort(TIMEOUT_BLOCK))); | 689 | while (!(action_userabort(TIMEOUT_BLOCK))); |
690 | |||
682 | #else | 691 | #else |
683 | /* Define this function in your target tree */ | 692 | /* Define this function in your target tree */ |
684 | return __dbg_hw_info(); | 693 | return __dbg_hw_info(); |
685 | #endif /* CONFIG_CPU */ | 694 | #endif /* CONFIG_CPU */ |
695 | viewportmanager_set_statusbar(true); | ||
686 | return false; | 696 | return false; |
687 | } | 697 | } |
688 | #else /* !HAVE_LCD_BITMAP */ | 698 | #else /* !HAVE_LCD_BITMAP */ |
@@ -824,6 +834,7 @@ static bool dbg_spdif(void) | |||
824 | 834 | ||
825 | lcd_clear_display(); | 835 | lcd_clear_display(); |
826 | lcd_setfont(FONT_SYSFIXED); | 836 | lcd_setfont(FONT_SYSFIXED); |
837 | viewportmanager_set_statusbar(false); | ||
827 | 838 | ||
828 | #ifdef HAVE_SPDIF_POWER | 839 | #ifdef HAVE_SPDIF_POWER |
829 | spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */ | 840 | spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */ |
@@ -976,6 +987,7 @@ static bool dbg_spdif(void) | |||
976 | spdif_power_enable(global_settings.spdif_enable); | 987 | spdif_power_enable(global_settings.spdif_enable); |
977 | #endif | 988 | #endif |
978 | 989 | ||
990 | viewportmanager_set_statusbar(true); | ||
979 | return false; | 991 | return false; |
980 | } | 992 | } |
981 | #endif /* CPU_COLDFIRE */ | 993 | #endif /* CPU_COLDFIRE */ |
@@ -1033,6 +1045,7 @@ bool dbg_ports(void) | |||
1033 | 1045 | ||
1034 | lcd_setfont(FONT_SYSFIXED); | 1046 | lcd_setfont(FONT_SYSFIXED); |
1035 | lcd_clear_display(); | 1047 | lcd_clear_display(); |
1048 | viewportmanager_set_statusbar(false); | ||
1036 | 1049 | ||
1037 | while(1) | 1050 | while(1) |
1038 | { | 1051 | { |
@@ -1057,7 +1070,10 @@ bool dbg_ports(void) | |||
1057 | 1070 | ||
1058 | lcd_update(); | 1071 | lcd_update(); |
1059 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | 1072 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) |
1073 | { | ||
1074 | viewportmanager_set_statusbar(true); | ||
1060 | return false; | 1075 | return false; |
1076 | } | ||
1061 | } | 1077 | } |
1062 | #elif defined(CPU_COLDFIRE) | 1078 | #elif defined(CPU_COLDFIRE) |
1063 | unsigned int gpio_out; | 1079 | unsigned int gpio_out; |
@@ -1075,6 +1091,7 @@ bool dbg_ports(void) | |||
1075 | 1091 | ||
1076 | lcd_clear_display(); | 1092 | lcd_clear_display(); |
1077 | lcd_setfont(FONT_SYSFIXED); | 1093 | lcd_setfont(FONT_SYSFIXED); |
1094 | viewportmanager_set_statusbar(false); | ||
1078 | 1095 | ||
1079 | while(1) | 1096 | while(1) |
1080 | { | 1097 | { |
@@ -1140,7 +1157,10 @@ bool dbg_ports(void) | |||
1140 | 1157 | ||
1141 | lcd_update(); | 1158 | lcd_update(); |
1142 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | 1159 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) |
1160 | { | ||
1161 | viewportmanager_set_statusbar(true); | ||
1143 | return false; | 1162 | return false; |
1163 | } | ||
1144 | } | 1164 | } |
1145 | 1165 | ||
1146 | #elif defined(CPU_PP502x) | 1166 | #elif defined(CPU_PP502x) |
@@ -1150,6 +1170,7 @@ bool dbg_ports(void) | |||
1150 | 1170 | ||
1151 | lcd_clear_display(); | 1171 | lcd_clear_display(); |
1152 | lcd_setfont(FONT_SYSFIXED); | 1172 | lcd_setfont(FONT_SYSFIXED); |
1173 | viewportmanager_set_statusbar(false); | ||
1153 | 1174 | ||
1154 | while(1) | 1175 | while(1) |
1155 | { | 1176 | { |
@@ -1247,7 +1268,10 @@ extern unsigned char serbuf[]; | |||
1247 | #endif | 1268 | #endif |
1248 | lcd_update(); | 1269 | lcd_update(); |
1249 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | 1270 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) |
1271 | { | ||
1272 | viewportmanager_set_statusbar(true); | ||
1250 | return false; | 1273 | return false; |
1274 | } | ||
1251 | } | 1275 | } |
1252 | 1276 | ||
1253 | #elif CONFIG_CPU == PP5002 | 1277 | #elif CONFIG_CPU == PP5002 |
@@ -1256,6 +1280,7 @@ extern unsigned char serbuf[]; | |||
1256 | 1280 | ||
1257 | lcd_clear_display(); | 1281 | lcd_clear_display(); |
1258 | lcd_setfont(FONT_SYSFIXED); | 1282 | lcd_setfont(FONT_SYSFIXED); |
1283 | viewportmanager_set_statusbar(false); | ||
1259 | 1284 | ||
1260 | while(1) | 1285 | while(1) |
1261 | { | 1286 | { |
@@ -1286,8 +1311,12 @@ extern unsigned char serbuf[]; | |||
1286 | 1311 | ||
1287 | lcd_update(); | 1312 | lcd_update(); |
1288 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | 1313 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) |
1314 | { | ||
1315 | viewportmanager_set_statusbar(true); | ||
1289 | return false; | 1316 | return false; |
1317 | } | ||
1290 | } | 1318 | } |
1319 | viewportmanager_set_statusbar(true); | ||
1291 | #else | 1320 | #else |
1292 | return __dbg_ports(); | 1321 | return __dbg_ports(); |
1293 | #endif /* CPU */ | 1322 | #endif /* CPU */ |
@@ -1302,6 +1331,7 @@ bool dbg_ports(void) | |||
1302 | int currval = 0; | 1331 | int currval = 0; |
1303 | 1332 | ||
1304 | lcd_clear_display(); | 1333 | lcd_clear_display(); |
1334 | viewportmanager_set_statusbar(false); | ||
1305 | 1335 | ||
1306 | while(1) | 1336 | while(1) |
1307 | { | 1337 | { |
@@ -1337,7 +1367,6 @@ bool dbg_ports(void) | |||
1337 | case 9: | 1367 | case 9: |
1338 | snprintf(buf, 32, "AN7: %03x", adc_read(7)); | 1368 | snprintf(buf, 32, "AN7: %03x", adc_read(7)); |
1339 | break; | 1369 | break; |
1340 | break; | ||
1341 | } | 1370 | } |
1342 | lcd_puts(0, 0, buf); | 1371 | lcd_puts(0, 0, buf); |
1343 | 1372 | ||
@@ -1367,6 +1396,7 @@ bool dbg_ports(void) | |||
1367 | break; | 1396 | break; |
1368 | } | 1397 | } |
1369 | } | 1398 | } |
1399 | viewportmanager_set_statusbar(true); | ||
1370 | return false; | 1400 | return false; |
1371 | } | 1401 | } |
1372 | #endif /* !HAVE_LCD_BITMAP */ | 1402 | #endif /* !HAVE_LCD_BITMAP */ |
@@ -1382,6 +1412,7 @@ static bool dbg_pcf(void) | |||
1382 | lcd_setfont(FONT_SYSFIXED); | 1412 | lcd_setfont(FONT_SYSFIXED); |
1383 | #endif | 1413 | #endif |
1384 | lcd_clear_display(); | 1414 | lcd_clear_display(); |
1415 | viewportmanager_set_statusbar(false); | ||
1385 | 1416 | ||
1386 | while(1) | 1417 | while(1) |
1387 | { | 1418 | { |
@@ -1417,10 +1448,12 @@ static bool dbg_pcf(void) | |||
1417 | lcd_update(); | 1448 | lcd_update(); |
1418 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | 1449 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) |
1419 | { | 1450 | { |
1451 | viewportmanager_set_statusbar(true); | ||
1420 | return false; | 1452 | return false; |
1421 | } | 1453 | } |
1422 | } | 1454 | } |
1423 | 1455 | ||
1456 | viewportmanager_set_statusbar(true); | ||
1424 | return false; | 1457 | return false; |
1425 | } | 1458 | } |
1426 | #endif | 1459 | #endif |
@@ -1436,6 +1469,7 @@ static bool dbg_cpufreq(void) | |||
1436 | lcd_setfont(FONT_SYSFIXED); | 1469 | lcd_setfont(FONT_SYSFIXED); |
1437 | #endif | 1470 | #endif |
1438 | lcd_clear_display(); | 1471 | lcd_clear_display(); |
1472 | viewportmanager_set_statusbar(false); | ||
1439 | 1473 | ||
1440 | while(1) | 1474 | while(1) |
1441 | { | 1475 | { |
@@ -1467,10 +1501,11 @@ static bool dbg_cpufreq(void) | |||
1467 | break; | 1501 | break; |
1468 | 1502 | ||
1469 | case ACTION_STD_CANCEL: | 1503 | case ACTION_STD_CANCEL: |
1504 | viewportmanager_set_statusbar(true); | ||
1470 | return false; | 1505 | return false; |
1471 | } | 1506 | } |
1472 | } | 1507 | } |
1473 | 1508 | viewportmanager_set_statusbar(true); | |
1474 | return false; | 1509 | return false; |
1475 | } | 1510 | } |
1476 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ | 1511 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ |
@@ -1563,6 +1598,7 @@ static bool view_battery(void) | |||
1563 | char buf[32]; | 1598 | char buf[32]; |
1564 | 1599 | ||
1565 | lcd_setfont(FONT_SYSFIXED); | 1600 | lcd_setfont(FONT_SYSFIXED); |
1601 | viewportmanager_set_statusbar(false); | ||
1566 | 1602 | ||
1567 | while(1) | 1603 | while(1) |
1568 | { | 1604 | { |
@@ -1803,9 +1839,11 @@ static bool view_battery(void) | |||
1803 | break; | 1839 | break; |
1804 | 1840 | ||
1805 | case ACTION_STD_CANCEL: | 1841 | case ACTION_STD_CANCEL: |
1842 | viewportmanager_set_statusbar(true); | ||
1806 | return false; | 1843 | return false; |
1807 | } | 1844 | } |
1808 | } | 1845 | } |
1846 | viewportmanager_set_statusbar(true); | ||
1809 | return false; | 1847 | return false; |
1810 | } | 1848 | } |
1811 | 1849 | ||
@@ -2434,6 +2472,7 @@ static bool cpu_boost_log(void) | |||
2434 | bool done; | 2472 | bool done; |
2435 | lcd_setfont(FONT_SYSFIXED); | 2473 | lcd_setfont(FONT_SYSFIXED); |
2436 | str = cpu_boost_log_getlog_first(); | 2474 | str = cpu_boost_log_getlog_first(); |
2475 | viewportmanager_set_statusbar(false); | ||
2437 | while (i < count) | 2476 | while (i < count) |
2438 | { | 2477 | { |
2439 | lcd_clear_display(); | 2478 | lcd_clear_display(); |
@@ -2467,6 +2506,7 @@ static bool cpu_boost_log(void) | |||
2467 | } | 2506 | } |
2468 | get_action(CONTEXT_STD,TIMEOUT_BLOCK); | 2507 | get_action(CONTEXT_STD,TIMEOUT_BLOCK); |
2469 | lcd_setfont(FONT_UI); | 2508 | lcd_setfont(FONT_UI); |
2509 | viewportmanager_set_statusbar(true); | ||
2470 | return false; | 2510 | return false; |
2471 | } | 2511 | } |
2472 | #endif | 2512 | #endif |
@@ -2485,11 +2525,12 @@ static bool dbg_scrollwheel(void) | |||
2485 | unsigned int speed; | 2525 | unsigned int speed; |
2486 | 2526 | ||
2487 | lcd_setfont(FONT_SYSFIXED); | 2527 | lcd_setfont(FONT_SYSFIXED); |
2528 | viewportmanager_set_statusbar(false); | ||
2488 | 2529 | ||
2489 | while (1) | 2530 | while (1) |
2490 | { | 2531 | { |
2491 | if (action_userabort(HZ/10)) | 2532 | if (action_userabort(HZ/10)) |
2492 | return false; | 2533 | break; |
2493 | 2534 | ||
2494 | lcd_clear_display(); | 2535 | lcd_clear_display(); |
2495 | 2536 | ||
@@ -2514,6 +2555,7 @@ static bool dbg_scrollwheel(void) | |||
2514 | 2555 | ||
2515 | lcd_update(); | 2556 | lcd_update(); |
2516 | } | 2557 | } |
2558 | viewportmanager_set_statusbar(true); | ||
2517 | return false; | 2559 | return false; |
2518 | } | 2560 | } |
2519 | #endif | 2561 | #endif |
diff --git a/apps/enc_config.c b/apps/enc_config.c index 2368c9e065..8f3237d2e6 100644 --- a/apps/enc_config.c +++ b/apps/enc_config.c | |||
@@ -295,7 +295,6 @@ static int enc_menuitem_callback(int action, | |||
295 | encoder_config_to_global(data->cfg); | 295 | encoder_config_to_global(data->cfg); |
296 | } | 296 | } |
297 | 297 | ||
298 | gui_syncstatusbar_draw(&statusbars, true); | ||
299 | } | 298 | } |
300 | return action; | 299 | return action; |
301 | } | 300 | } |
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index a3f5da92ea..3b2f16db8c 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c | |||
@@ -45,19 +45,13 @@ | |||
45 | #define SCROLLBAR_WIDTH 6 | 45 | #define SCROLLBAR_WIDTH 6 |
46 | #define ICON_PADDING 1 | 46 | #define ICON_PADDING 1 |
47 | 47 | ||
48 | static struct viewport title_text[NB_SCREENS], title_icons[NB_SCREENS], | 48 | /* these are static to make scrolling work */ |
49 | list_text[NB_SCREENS], list_icons[NB_SCREENS]; | 49 | static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS]; |
50 | 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, | 51 | int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width, |
58 | int text_pos, struct screen * display, | 52 | int text_pos, struct screen * display, |
59 | struct viewport *vp); | 53 | struct viewport *vp); |
60 | bool list_display_title(struct gui_synclist *list, struct viewport *vp); | 54 | bool list_display_title(struct gui_synclist *list, enum screen_type screen); |
61 | 55 | ||
62 | /* Draw the list... | 56 | /* Draw the list... |
63 | internal screen layout: | 57 | internal screen layout: |
@@ -70,47 +64,51 @@ bool list_display_title(struct gui_synclist *list, struct viewport *vp); | |||
70 | | | | | | 64 | | | | | |
71 | ------------------ | 65 | ------------------ |
72 | */ | 66 | */ |
73 | static bool draw_title(struct screen *display, struct viewport *parent, | 67 | static bool draw_title(struct screen *display, struct gui_synclist *list) |
74 | struct gui_synclist *list) | ||
75 | { | 68 | { |
76 | struct viewport *vp_icons = &title_icons[display->screen_type]; | 69 | const int screen = display->screen_type; |
77 | struct viewport *vp_text = &title_text[display->screen_type]; | 70 | if (!list_display_title(list, screen)) |
78 | if (!list_display_title(list, parent)) | ||
79 | return false; | 71 | return false; |
80 | *vp_text = *parent; | 72 | title_text[screen] = *(list->parent[screen]); |
81 | vp_text->height = list_title_height(list, parent); | 73 | title_text[screen].height |
74 | = font_get(title_text[screen].font)->height; | ||
82 | if (list->title_icon != Icon_NOICON && global_settings.show_icons) | 75 | if (list->title_icon != Icon_NOICON && global_settings.show_icons) |
83 | { | 76 | { |
84 | *vp_icons = *vp_text; | 77 | struct viewport title_icon = *(list->parent[screen]); |
85 | vp_icons->width = get_icon_width(display->screen_type) | 78 | title_icon = title_text[screen]; |
79 | title_icon.width = get_icon_width(screen) | ||
86 | + ICON_PADDING*2; | 80 | + ICON_PADDING*2; |
87 | vp_icons->x += ICON_PADDING; | 81 | title_icon.x += ICON_PADDING; |
88 | 82 | ||
89 | vp_text->width -= vp_icons->width + vp_icons->x; | 83 | title_text[screen].width -= title_icon.width + title_icon.x; |
90 | vp_text->x += vp_icons->width + vp_icons->x; | 84 | title_text[screen].x += title_icon.width + title_icon.x; |
91 | 85 | ||
92 | display->set_viewport(vp_icons); | 86 | display->set_viewport(&title_icon); |
93 | screen_put_icon(display, 0, 0, list->title_icon); | 87 | screen_put_icon(display, 0, 0, list->title_icon); |
94 | } | 88 | } |
95 | display->set_viewport(vp_text); | 89 | title_text[screen].drawmode = STYLE_DEFAULT; |
96 | vp_text->drawmode = STYLE_DEFAULT; | ||
97 | #ifdef HAVE_LCD_COLOR | 90 | #ifdef HAVE_LCD_COLOR |
98 | if (list->title_color >= 0) | 91 | if (list->title_color >= 0) |
99 | { | 92 | { |
100 | vp_text->drawmode |= (STYLE_COLORED|list->title_color);} | 93 | title_text[screen].drawmode |
94 | |= (STYLE_COLORED|list->title_color); | ||
95 | } | ||
101 | #endif | 96 | #endif |
102 | display->puts_scroll_style_offset(0, 0, list->title, | 97 | display->set_viewport(&title_text[screen]); |
103 | vp_text->drawmode, 0); | 98 | display->puts_scroll_style(0, 0, list->title, |
99 | title_text[screen].drawmode); | ||
104 | return true; | 100 | return true; |
105 | } | 101 | } |
106 | 102 | ||
107 | void list_draw(struct screen *display, struct viewport *parent, | 103 | void list_draw(struct screen *display, struct gui_synclist *list) |
108 | struct gui_synclist *list) | ||
109 | { | 104 | { |
105 | struct viewport list_icons; | ||
110 | int start, end, line_height, i; | 106 | int start, end, line_height, i; |
111 | int icon_width = get_icon_width(display->screen_type) + ICON_PADDING; | 107 | const int screen = display->screen_type; |
112 | bool show_cursor = !global_settings.cursor_style && | 108 | const int icon_width = get_icon_width(screen) + ICON_PADDING; |
109 | const bool show_cursor = !global_settings.cursor_style && | ||
113 | list->show_selection_marker; | 110 | list->show_selection_marker; |
111 | struct viewport *parent = (list->parent[screen]); | ||
114 | #ifdef HAVE_LCD_COLOR | 112 | #ifdef HAVE_LCD_COLOR |
115 | unsigned char cur_line = 0; | 113 | unsigned char cur_line = 0; |
116 | #endif | 114 | #endif |
@@ -120,55 +118,55 @@ void list_draw(struct screen *display, struct viewport *parent, | |||
120 | display->set_viewport(parent); | 118 | display->set_viewport(parent); |
121 | display->clear_viewport(); | 119 | display->clear_viewport(); |
122 | display->stop_scroll(); | 120 | display->stop_scroll(); |
123 | list_text[display->screen_type] = *parent; | 121 | list_text[screen] = *parent; |
124 | if ((show_title = draw_title(display, parent, list))) | 122 | if ((show_title = draw_title(display, list))) |
125 | { | 123 | { |
126 | list_text[display->screen_type].y += list_title_height(list, parent); | 124 | list_text[screen].y += line_height; |
127 | list_text[display->screen_type].height -= list_title_height(list, parent); | 125 | list_text[screen].height -= line_height; |
128 | } | 126 | } |
129 | 127 | ||
130 | start = list->start_item[display->screen_type]; | 128 | start = list->start_item[screen]; |
131 | end = start + viewport_get_nb_lines(&list_text[display->screen_type]); | 129 | end = start + viewport_get_nb_lines(&list_text[screen]); |
132 | 130 | ||
133 | /* draw the scrollbar if its needed */ | 131 | /* draw the scrollbar if its needed */ |
134 | if (global_settings.scrollbar && | 132 | if (global_settings.scrollbar && |
135 | viewport_get_nb_lines(&list_text[display->screen_type]) < list->nb_items) | 133 | viewport_get_nb_lines(&list_text[screen]) < list->nb_items) |
136 | { | 134 | { |
137 | struct viewport vp; | 135 | struct viewport vp; |
138 | vp = list_text[display->screen_type]; | 136 | vp = list_text[screen]; |
139 | vp.width = SCROLLBAR_WIDTH; | 137 | vp.width = SCROLLBAR_WIDTH; |
140 | list_text[display->screen_type].width -= SCROLLBAR_WIDTH; | 138 | list_text[screen].width -= SCROLLBAR_WIDTH; |
141 | list_text[display->screen_type].x += SCROLLBAR_WIDTH; | 139 | list_text[screen].x += SCROLLBAR_WIDTH; |
142 | vp.height = line_height * | 140 | vp.height = line_height * |
143 | viewport_get_nb_lines(&list_text[display->screen_type]); | 141 | viewport_get_nb_lines(&list_text[screen]); |
144 | vp.x = parent->x; | 142 | vp.x = parent->x; |
145 | display->set_viewport(&vp); | 143 | display->set_viewport(&vp); |
146 | gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, | 144 | gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, |
147 | vp.height, list->nb_items, | 145 | vp.height, list->nb_items, |
148 | list->start_item[display->screen_type], | 146 | list->start_item[screen], |
149 | list->start_item[display->screen_type] + end-start, | 147 | list->start_item[screen] + end-start, |
150 | VERTICAL); | 148 | VERTICAL); |
151 | } | 149 | } |
152 | else if (show_title) | 150 | else if (show_title) |
153 | { | 151 | { |
154 | /* shift everything right a bit... */ | 152 | /* shift everything right a bit... */ |
155 | list_text[display->screen_type].width -= SCROLLBAR_WIDTH; | 153 | list_text[screen].width -= SCROLLBAR_WIDTH; |
156 | list_text[display->screen_type].x += SCROLLBAR_WIDTH; | 154 | list_text[screen].x += SCROLLBAR_WIDTH; |
157 | } | 155 | } |
158 | 156 | ||
159 | /* setup icon placement */ | 157 | /* setup icon placement */ |
160 | list_icons[display->screen_type] = list_text[display->screen_type]; | 158 | list_icons = list_text[screen]; |
161 | int icon_count = global_settings.show_icons && | 159 | int icon_count = global_settings.show_icons && |
162 | (list->callback_get_item_icon != NULL) ? 1 : 0; | 160 | (list->callback_get_item_icon != NULL) ? 1 : 0; |
163 | if (show_cursor) | 161 | if (show_cursor) |
164 | icon_count++; | 162 | icon_count++; |
165 | if (icon_count) | 163 | if (icon_count) |
166 | { | 164 | { |
167 | list_icons[display->screen_type].width = icon_width * icon_count; | 165 | list_icons.width = icon_width * icon_count; |
168 | list_text[display->screen_type].width -= | 166 | list_text[screen].width -= |
169 | list_icons[display->screen_type].width + ICON_PADDING; | 167 | list_icons.width + ICON_PADDING; |
170 | list_text[display->screen_type].x += | 168 | list_text[screen].x += |
171 | list_icons[display->screen_type].width + ICON_PADDING; | 169 | list_icons.width + ICON_PADDING; |
172 | } | 170 | } |
173 | 171 | ||
174 | for (i=start; i<end && i<list->nb_items; i++) | 172 | for (i=start; i<end && i<list->nb_items; i++) |
@@ -181,14 +179,14 @@ void list_draw(struct screen *display, struct viewport *parent, | |||
181 | s = list->callback_get_item_name(i, list->data, entry_buffer, | 179 | s = list->callback_get_item_name(i, list->data, entry_buffer, |
182 | sizeof(entry_buffer)); | 180 | sizeof(entry_buffer)); |
183 | entry_name = P2STR(s); | 181 | entry_name = P2STR(s); |
184 | display->set_viewport(&list_text[display->screen_type]); | 182 | display->set_viewport(&list_text[screen]); |
185 | list_text[display->screen_type].drawmode = STYLE_DEFAULT; | 183 | list_text[screen].drawmode = STYLE_DEFAULT; |
186 | /* position the string at the correct offset place */ | 184 | /* position the string at the correct offset place */ |
187 | int item_width,h; | 185 | int item_width,h; |
188 | display->getstringsize(entry_name, &item_width, &h); | 186 | display->getstringsize(entry_name, &item_width, &h); |
189 | item_offset = gui_list_get_item_offset(list, item_width, | 187 | item_offset = gui_list_get_item_offset(list, item_width, |
190 | text_pos, display, | 188 | text_pos, display, |
191 | &list_text[display->screen_type]); | 189 | &list_text[screen]); |
192 | 190 | ||
193 | #ifdef HAVE_LCD_COLOR | 191 | #ifdef HAVE_LCD_COLOR |
194 | /* if the list has a color callback */ | 192 | /* if the list has a color callback */ |
@@ -198,73 +196,75 @@ void list_draw(struct screen *display, struct viewport *parent, | |||
198 | /* if color selected */ | 196 | /* if color selected */ |
199 | if (color >= 0) | 197 | if (color >= 0) |
200 | { | 198 | { |
201 | list_text[display->screen_type].drawmode |= STYLE_COLORED|color; | 199 | list_text[screen].drawmode |= STYLE_COLORED|color; |
202 | } | 200 | } |
203 | } | 201 | } |
204 | #endif | 202 | #endif |
205 | if(i >= list->selected_item && | 203 | if(i >= list->selected_item && i < list->selected_item |
206 | i < list->selected_item + list->selected_size && list->show_selection_marker) | 204 | + list->selected_size && list->show_selection_marker) |
207 | {/* The selected item must be displayed scrolling */ | 205 | {/* The selected item must be displayed scrolling */ |
208 | if (global_settings.cursor_style == 1 | 206 | if (global_settings.cursor_style == 1 |
209 | #ifdef HAVE_REMOTE_LCD | 207 | #ifdef HAVE_REMOTE_LCD |
210 | /* the global_settings.cursor_style check is here to make sure | 208 | /* the global_settings.cursor_style check is here to make |
211 | if they want the cursor instead of bar it will work */ | 209 | * sure if they want the cursor instead of bar it will work |
210 | */ | ||
212 | || (display->depth < 16 && global_settings.cursor_style) | 211 | || (display->depth < 16 && global_settings.cursor_style) |
213 | #endif | 212 | #endif |
214 | ) | 213 | ) |
215 | { | 214 | { |
216 | /* Display inverted-line-style */ | 215 | /* Display inverted-line-style */ |
217 | list_text[display->screen_type].drawmode = STYLE_INVERT; | 216 | list_text[screen].drawmode = STYLE_INVERT; |
218 | } | 217 | } |
219 | #ifdef HAVE_LCD_COLOR | 218 | #ifdef HAVE_LCD_COLOR |
220 | else if (global_settings.cursor_style == 2) | 219 | else if (global_settings.cursor_style == 2) |
221 | { | 220 | { |
222 | /* Display colour line selector */ | 221 | /* Display colour line selector */ |
223 | list_text[display->screen_type].drawmode = STYLE_COLORBAR; | 222 | list_text[screen].drawmode = STYLE_COLORBAR; |
224 | } | 223 | } |
225 | else if (global_settings.cursor_style == 3) | 224 | else if (global_settings.cursor_style == 3) |
226 | { | 225 | { |
227 | /* Display gradient line selector */ | 226 | /* Display gradient line selector */ |
228 | list_text[display->screen_type].drawmode = STYLE_GRADIENT; | 227 | list_text[screen].drawmode = STYLE_GRADIENT; |
229 | 228 | ||
230 | /* Make the lcd driver know how many lines the gradient should | 229 | /* Make the lcd driver know how many lines the gradient should |
231 | cover and current line number */ | 230 | cover and current line number */ |
232 | /* number of selected lines */ | 231 | /* number of selected lines */ |
233 | list_text[display->screen_type].drawmode |= NUMLN_PACK(list->selected_size); | 232 | list_text[screen].drawmode |= NUMLN_PACK(list->selected_size); |
234 | /* current line number, zero based */ | 233 | /* current line number, zero based */ |
235 | list_text[display->screen_type].drawmode |= CURLN_PACK(cur_line); | 234 | list_text[screen].drawmode |= CURLN_PACK(cur_line); |
236 | cur_line++; | 235 | cur_line++; |
237 | } | 236 | } |
238 | #endif | 237 | #endif |
239 | /* if the text is smaller than the viewport size */ | 238 | /* if the text is smaller than the viewport size */ |
240 | if (item_offset > item_width - (list_text[display->screen_type].width - text_pos)) | 239 | if (item_offset> item_width |
240 | - (list_text[screen].width - text_pos)) | ||
241 | { | 241 | { |
242 | /* don't scroll */ | 242 | /* don't scroll */ |
243 | display->puts_style_offset(0, i-start, entry_name, | 243 | display->puts_style_offset(0, i-start, entry_name, |
244 | list_text[display->screen_type].drawmode, item_offset); | 244 | list_text[screen].drawmode, item_offset); |
245 | } | 245 | } |
246 | else | 246 | else |
247 | { | 247 | { |
248 | display->puts_scroll_style_offset(0, i-start, entry_name, | 248 | display->puts_scroll_style_offset(0, i-start, entry_name, |
249 | list_text[display->screen_type].drawmode, item_offset); | 249 | list_text[screen].drawmode, item_offset); |
250 | } | 250 | } |
251 | } | 251 | } |
252 | else | 252 | else |
253 | { | 253 | { |
254 | if (list->scroll_all) | 254 | if (list->scroll_all) |
255 | display->puts_scroll_style_offset(0, i-start, entry_name, | 255 | display->puts_scroll_style_offset(0, i-start, entry_name, |
256 | list_text[display->screen_type].drawmode, item_offset); | 256 | list_text[screen].drawmode, item_offset); |
257 | else | 257 | else |
258 | display->puts_style_offset(0, i-start, entry_name, | 258 | display->puts_style_offset(0, i-start, entry_name, |
259 | list_text[display->screen_type].drawmode, item_offset); | 259 | list_text[screen].drawmode, item_offset); |
260 | } | 260 | } |
261 | /* do the icon */ | 261 | /* do the icon */ |
262 | if (list->callback_get_item_icon && global_settings.show_icons) | 262 | if (list->callback_get_item_icon && global_settings.show_icons) |
263 | { | 263 | { |
264 | display->set_viewport(&list_icons[display->screen_type]); | 264 | display->set_viewport(&list_icons); |
265 | screen_put_icon_with_offset(display, show_cursor?1:0, | 265 | screen_put_icon_with_offset(display, show_cursor?1:0, |
266 | (i-start),show_cursor?ICON_PADDING:0,0, | 266 | (i-start),show_cursor?ICON_PADDING:0,0, |
267 | list->callback_get_item_icon(i, list->data)); | 267 | list->callback_get_item_icon(i, list->data)); |
268 | if (show_cursor && i >= list->selected_item && | 268 | if (show_cursor && i >= list->selected_item && |
269 | i < list->selected_item + list->selected_size) | 269 | i < list->selected_item + list->selected_size) |
270 | { | 270 | { |
@@ -274,14 +274,12 @@ void list_draw(struct screen *display, struct viewport *parent, | |||
274 | else if (show_cursor && i >= list->selected_item && | 274 | else if (show_cursor && i >= list->selected_item && |
275 | i < list->selected_item + list->selected_size) | 275 | i < list->selected_item + list->selected_size) |
276 | { | 276 | { |
277 | display->set_viewport(&list_icons[display->screen_type]); | 277 | display->set_viewport(&list_icons); |
278 | screen_put_icon(display, 0, (i-start), Icon_Cursor); | 278 | screen_put_icon(display, 0, (i-start), Icon_Cursor); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | |||
282 | display->set_viewport(parent); | 281 | display->set_viewport(parent); |
283 | display->update_viewport(); | 282 | display->update_viewport(); |
284 | display->set_viewport(NULL); | ||
285 | } | 283 | } |
286 | 284 | ||
287 | 285 | ||
@@ -292,10 +290,10 @@ void list_draw(struct screen *display, struct viewport *parent, | |||
292 | */ | 290 | */ |
293 | static bool scrolling=false; | 291 | static bool scrolling=false; |
294 | 292 | ||
295 | unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct viewport *parent) | 293 | unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) |
296 | { | 294 | { |
297 | short x, y; | 295 | short x, y; |
298 | unsigned button = action_get_touchscreen_press(&x, &y); | 296 | int button = action_get_touchscreen_press(&x, &y); |
299 | int line; | 297 | int line; |
300 | struct screen *display = &screens[SCREEN_MAIN]; | 298 | struct screen *display = &screens[SCREEN_MAIN]; |
301 | if (button == BUTTON_NONE) | 299 | if (button == BUTTON_NONE) |
@@ -315,13 +313,15 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view | |||
315 | /* Scroll bar */ | 313 | /* Scroll bar */ |
316 | else | 314 | else |
317 | { | 315 | { |
318 | int nb_lines = viewport_get_nb_lines(&list_text[SCREEN_MAIN]); | 316 | int nb_lines = viewport_get_nb_lines(&list_text[screen]); |
319 | if (nb_lines < gui_list->nb_items) | 317 | if (nb_lines < gui_list->nb_items) |
320 | { | 318 | { |
321 | int scrollbar_size = nb_lines * font_get(parent->font)->height; | 319 | int scrollbar_size = nb_lines* |
322 | int actual_y = y - list_text[SCREEN_MAIN].y; | 320 | font_get(gui_list->parent[screen]->font)->height; |
321 | int actual_y = y - list_text[screen].y; | ||
323 | 322 | ||
324 | int new_selection = (actual_y * gui_list->nb_items) / scrollbar_size; | 323 | int new_selection = (actual_y * gui_list->nb_items) |
324 | / scrollbar_size; | ||
325 | 325 | ||
326 | int start_item = new_selection - nb_lines/2; | 326 | int start_item = new_selection - nb_lines/2; |
327 | if(start_item < 0) | 327 | if(start_item < 0) |
@@ -329,7 +329,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view | |||
329 | else if(start_item > gui_list->nb_items - nb_lines) | 329 | else if(start_item > gui_list->nb_items - nb_lines) |
330 | start_item = gui_list->nb_items - nb_lines; | 330 | start_item = gui_list->nb_items - nb_lines; |
331 | 331 | ||
332 | gui_list->start_item[SCREEN_MAIN] = start_item; | 332 | gui_list->start_item[screen] = start_item; |
333 | gui_synclist_select_item(gui_list, new_selection); | 333 | gui_synclist_select_item(gui_list, new_selection); |
334 | 334 | ||
335 | return ACTION_REDRAW; | 335 | return ACTION_REDRAW; |
@@ -350,27 +350,31 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view | |||
350 | * | will bring up the context menu of it. | | 350 | * | will bring up the context menu of it. | |
351 | * |--------------------------------------------------------| | 351 | * |--------------------------------------------------------| |
352 | */ | 352 | */ |
353 | if (y > list_text[SCREEN_MAIN].y) | 353 | if (y > list_text[screen].y) |
354 | { | 354 | { |
355 | int line_height, actual_y; | 355 | int line_height, actual_y; |
356 | static int last_y = 0; | 356 | static int last_y = 0; |
357 | 357 | ||
358 | actual_y = y - list_text[SCREEN_MAIN].y; | 358 | actual_y = y - list_text[screen].y; |
359 | line_height = font_get(parent->font)->height; | 359 | line_height = font_get(gui_list->parent[screen]->font)->height; |
360 | line = actual_y / line_height; | 360 | line = actual_y / line_height; |
361 | 361 | ||
362 | if(actual_y%line_height == 0) /* Pressed a border */ | 362 | if(actual_y%line_height == 0) /* Pressed a border */ |
363 | return ACTION_NONE; | 363 | return ACTION_NONE; |
364 | 364 | ||
365 | if (gui_list->start_item[SCREEN_MAIN]+line > gui_list->nb_items) /* Pressed below the list*/ | 365 | if (gui_list->start_item[screen]+line > gui_list->nb_items) |
366 | { | ||
367 | /* Pressed below the list*/ | ||
366 | return ACTION_NONE; | 368 | return ACTION_NONE; |
367 | 369 | } | |
368 | last_y = actual_y; | 370 | last_y = actual_y; |
369 | if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN] && button ^ BUTTON_REL) | 371 | if (line != gui_list->selected_item |
372 | - gui_list->start_item[screen] && button ^ BUTTON_REL) | ||
370 | { | 373 | { |
371 | if(button & BUTTON_REPEAT) | 374 | if(button & BUTTON_REPEAT) |
372 | scrolling = true; | 375 | scrolling = true; |
373 | gui_synclist_select_item(gui_list, gui_list->start_item[SCREEN_MAIN]+line); | 376 | gui_synclist_select_item(gui_list, gui_list->start_item[screen] |
377 | + line); | ||
374 | return ACTION_REDRAW; | 378 | return ACTION_REDRAW; |
375 | } | 379 | } |
376 | 380 | ||
@@ -378,15 +382,17 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view | |||
378 | { | 382 | { |
379 | if(!scrolling) | 383 | if(!scrolling) |
380 | { | 384 | { |
381 | /* Pen was hold on the same line as the previously selected one | 385 | /* Pen was hold on the same line as the |
382 | * => simulate long button press | 386 | * previously selected one |
387 | * => simulate long button press | ||
383 | */ | 388 | */ |
384 | return ACTION_STD_CONTEXT; | 389 | return ACTION_STD_CONTEXT; |
385 | } | 390 | } |
386 | else | 391 | else |
387 | { | 392 | { |
388 | /* Pen was moved across several lines and then released on this one | 393 | /* Pen was moved across several lines and then released on |
389 | * => do nothing | 394 | * this one |
395 | * => do nothing | ||
390 | */ | 396 | */ |
391 | scrolling = false; | 397 | scrolling = false; |
392 | return ACTION_NONE; | 398 | return ACTION_NONE; |
@@ -394,8 +400,8 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view | |||
394 | } | 400 | } |
395 | else if(button == BUTTON_REL) | 401 | else if(button == BUTTON_REL) |
396 | { | 402 | { |
397 | /* Pen was released on either the same line as the previously selected one | 403 | /* Pen was released on either the same line as the previously |
398 | * or an other one | 404 | * selected one or an other one |
399 | * => simulate short press | 405 | * => simulate short press |
400 | */ | 406 | */ |
401 | return ACTION_STD_OK; | 407 | return ACTION_STD_OK; |
@@ -404,11 +410,16 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view | |||
404 | return ACTION_NONE; | 410 | return ACTION_NONE; |
405 | } | 411 | } |
406 | /* Title goes up one level (only on BUTTON_REL&~BUTTON_REPEAT) */ | 412 | /* Title goes up one level (only on BUTTON_REL&~BUTTON_REPEAT) */ |
407 | else if (y > title_text[SCREEN_MAIN].y && draw_title(display, parent, gui_list) && button == BUTTON_REL) | 413 | else if (y > title_text[screen].y && draw_title(display, gui_list) |
414 | && button == BUTTON_REL) | ||
415 | { | ||
408 | return ACTION_STD_CANCEL; | 416 | return ACTION_STD_CANCEL; |
417 | } | ||
409 | /* Title or statusbar is cancel (only on BUTTON_REL&~BUTTON_REPEAT) */ | 418 | /* Title or statusbar is cancel (only on BUTTON_REL&~BUTTON_REPEAT) */ |
410 | else if (global_settings.statusbar && button == BUTTON_REL) | 419 | else if (global_settings.statusbar && button == BUTTON_REL) |
420 | { | ||
411 | return ACTION_STD_CANCEL; | 421 | return ACTION_STD_CANCEL; |
422 | } | ||
412 | } | 423 | } |
413 | return ACTION_NONE; | 424 | return ACTION_NONE; |
414 | } | 425 | } |
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c index b1d0adcdd6..198026e44c 100644 --- a/apps/gui/charcell/list.c +++ b/apps/gui/charcell/list.c | |||
@@ -40,10 +40,8 @@ | |||
40 | #include "misc.h" | 40 | #include "misc.h" |
41 | #include "talk.h" | 41 | #include "talk.h" |
42 | 42 | ||
43 | void list_draw(struct screen *display, struct viewport *parent, | 43 | void list_draw(struct screen *display, struct gui_synclist *gui_list) |
44 | struct gui_synclist *gui_list) | ||
45 | { | 44 | { |
46 | (void)parent; | ||
47 | int text_pos; | 45 | int text_pos; |
48 | bool draw_icons = (gui_list->callback_get_item_icon != NULL && | 46 | bool draw_icons = (gui_list->callback_get_item_icon != NULL && |
49 | global_settings.show_icons); | 47 | global_settings.show_icons); |
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 46453dc4c9..5e134b5fa3 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include "playback.h" | 61 | #include "playback.h" |
62 | #endif | 62 | #endif |
63 | #include "backdrop.h" | 63 | #include "backdrop.h" |
64 | #include "viewport.h" | ||
64 | 65 | ||
65 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ | 66 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ |
66 | /* 3% of 30min file == 54s step size */ | 67 | /* 3% of 30min file == 54s step size */ |
@@ -78,17 +79,17 @@ | |||
78 | #ifdef HAVE_LCD_BITMAP | 79 | #ifdef HAVE_LCD_BITMAP |
79 | static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force) | 80 | static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force) |
80 | { | 81 | { |
82 | (void)force; | ||
81 | bool draw = global_settings.statusbar; | 83 | bool draw = global_settings.statusbar; |
82 | 84 | ||
83 | if (wps->data->wps_sb_tag) | 85 | if (wps->data->wps_sb_tag) |
84 | draw = wps->data->show_sb_on_wps; | 86 | draw = wps->data->show_sb_on_wps; |
85 | 87 | ||
86 | if (draw) | 88 | if (!draw) |
87 | gui_statusbar_draw(wps->statusbar, force); | 89 | viewportmanager_set_statusbar(false); |
88 | } | 90 | } |
89 | #else | 91 | #else |
90 | #define gui_wps_statusbar_draw(wps, force) \ | 92 | #define gui_wps_statusbar_draw(wps, force) |
91 | gui_statusbar_draw((wps)->statusbar, (force)) | ||
92 | #endif | 93 | #endif |
93 | #include "pcmbuf.h" | 94 | #include "pcmbuf.h" |
94 | 95 | ||
@@ -335,9 +336,6 @@ bool gui_wps_display(void) | |||
335 | if (!wps_state.id3 && !(audio_status() & AUDIO_STATUS_PLAY)) | 336 | if (!wps_state.id3 && !(audio_status() & AUDIO_STATUS_PLAY)) |
336 | { | 337 | { |
337 | global_status.resume_index = -1; | 338 | global_status.resume_index = -1; |
338 | #ifdef HAVE_LCD_BITMAP | ||
339 | gui_syncstatusbar_draw(&statusbars, true); | ||
340 | #endif | ||
341 | splash(HZ, ID2P(LANG_END_PLAYLIST)); | 339 | splash(HZ, ID2P(LANG_END_PLAYLIST)); |
342 | return true; | 340 | return true; |
343 | } | 341 | } |
diff --git a/apps/gui/list.c b/apps/gui/list.c index 00d84cb446..b70cf424ee 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -61,7 +61,7 @@ static int force_list_reinit = false; | |||
61 | 61 | ||
62 | static void gui_list_select_at_offset(struct gui_synclist * gui_list, | 62 | static void gui_list_select_at_offset(struct gui_synclist * gui_list, |
63 | int offset); | 63 | int offset); |
64 | void list_draw(struct screen *display, struct viewport *parent, struct gui_synclist *list); | 64 | void list_draw(struct screen *display, struct gui_synclist *list); |
65 | 65 | ||
66 | #ifdef HAVE_LCD_BITMAP | 66 | #ifdef HAVE_LCD_BITMAP |
67 | static struct viewport parent[NB_SCREENS]; | 67 | static struct viewport parent[NB_SCREENS]; |
@@ -106,12 +106,13 @@ void list_init_viewports(struct gui_synclist *list) | |||
106 | #endif | 106 | #endif |
107 | 107 | ||
108 | #ifdef HAVE_LCD_BITMAP | 108 | #ifdef HAVE_LCD_BITMAP |
109 | bool list_display_title(struct gui_synclist *list, struct viewport *vp) | 109 | bool list_display_title(struct gui_synclist *list, enum screen_type screen) |
110 | { | 110 | { |
111 | return list->title != NULL && viewport_get_nb_lines(vp)>2; | 111 | return list->title != NULL && |
112 | viewport_get_nb_lines(list->parent[screen])>2; | ||
112 | } | 113 | } |
113 | #else | 114 | #else |
114 | #define list_display_title(l,v) false | 115 | #define list_display_title(l, i) false |
115 | #endif | 116 | #endif |
116 | 117 | ||
117 | /* | 118 | /* |
@@ -180,10 +181,11 @@ void gui_synclist_hide_selection_marker(struct gui_synclist * lists, bool hide) | |||
180 | 181 | ||
181 | 182 | ||
182 | #ifdef HAVE_LCD_BITMAP | 183 | #ifdef HAVE_LCD_BITMAP |
183 | int list_title_height(struct gui_synclist *list, struct viewport *vp); | 184 | int gui_list_get_item_offset(struct gui_synclist * gui_list, |
184 | 185 | int item_width, | |
185 | int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width, | 186 | int text_pos, |
186 | int text_pos, struct screen * display, struct viewport *vp) | 187 | struct screen * display, |
188 | struct viewport *vp) | ||
187 | { | 189 | { |
188 | int item_offset; | 190 | int item_offset; |
189 | 191 | ||
@@ -241,7 +243,7 @@ void gui_synclist_draw(struct gui_synclist *gui_list) | |||
241 | last_list = gui_list; | 243 | last_list = gui_list; |
242 | FOR_NB_SCREENS(i) | 244 | FOR_NB_SCREENS(i) |
243 | { | 245 | { |
244 | list_draw(&screens[i], gui_list->parent[i], gui_list); | 246 | list_draw(&screens[i], gui_list); |
245 | } | 247 | } |
246 | } | 248 | } |
247 | 249 | ||
@@ -253,8 +255,8 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, | |||
253 | int difference = gui_list->selected_item - gui_list->start_item[screen]; | 255 | int difference = gui_list->selected_item - gui_list->start_item[screen]; |
254 | struct viewport vp = *gui_list->parent[screen]; | 256 | struct viewport vp = *gui_list->parent[screen]; |
255 | #ifdef HAVE_LCD_BITMAP | 257 | #ifdef HAVE_LCD_BITMAP |
256 | if (list_display_title(gui_list, gui_list->parent[screen])) | 258 | if (list_display_title(gui_list, screen)) |
257 | vp.height -= list_title_height(gui_list,gui_list->parent[screen]); | 259 | vp.height -= font_get(gui_list->parent[screen]->font)->height; |
258 | #endif | 260 | #endif |
259 | nb_lines = viewport_get_nb_lines(&vp); | 261 | nb_lines = viewport_get_nb_lines(&vp); |
260 | 262 | ||
@@ -273,7 +275,10 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, | |||
273 | if (global_settings.scroll_paginated) | 275 | if (global_settings.scroll_paginated) |
274 | { | 276 | { |
275 | if (gui_list->start_item[screen] > gui_list->selected_item) | 277 | if (gui_list->start_item[screen] > gui_list->selected_item) |
276 | gui_list->start_item[screen] = (gui_list->selected_item/nb_lines)*nb_lines; | 278 | { |
279 | gui_list->start_item[screen] = (gui_list->selected_item/nb_lines) | ||
280 | *nb_lines; | ||
281 | } | ||
277 | if (gui_list->nb_items <= nb_lines) | 282 | if (gui_list->nb_items <= nb_lines) |
278 | gui_list->start_item[screen] = 0; | 283 | gui_list->start_item[screen] = 0; |
279 | } | 284 | } |
@@ -293,7 +298,7 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, | |||
293 | if (bottom < 0) | 298 | if (bottom < 0) |
294 | bottom = 0; | 299 | bottom = 0; |
295 | gui_list->start_item[screen] = MIN(bottom, gui_list->start_item[screen] + | 300 | gui_list->start_item[screen] = MIN(bottom, gui_list->start_item[screen] + |
296 | 2*gui_list->selected_size); | 301 | 2*gui_list->selected_size); |
297 | } | 302 | } |
298 | else if (global_settings.scroll_paginated) | 303 | else if (global_settings.scroll_paginated) |
299 | { | 304 | { |
@@ -351,8 +356,8 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list, | |||
351 | { | 356 | { |
352 | struct viewport vp = *gui_list->parent[i]; | 357 | struct viewport vp = *gui_list->parent[i]; |
353 | #ifdef HAVE_LCD_BITMAP | 358 | #ifdef HAVE_LCD_BITMAP |
354 | if (list_display_title(gui_list, gui_list->parent[i])) | 359 | if (list_display_title(gui_list, i)) |
355 | vp.height -= list_title_height(gui_list,gui_list->parent[i]); | 360 | vp.height -= font_get(gui_list->parent[i]->font)->height; |
356 | #endif | 361 | #endif |
357 | nb_lines = viewport_get_nb_lines(&vp); | 362 | nb_lines = viewport_get_nb_lines(&vp); |
358 | if (offset > 0) | 363 | if (offset > 0) |
@@ -578,11 +583,11 @@ void gui_synclist_speak_item(struct gui_synclist * lists) | |||
578 | extern intptr_t get_action_data(void); | 583 | extern intptr_t get_action_data(void); |
579 | #if defined(HAVE_TOUCHSCREEN) | 584 | #if defined(HAVE_TOUCHSCREEN) |
580 | /* this needs to be fixed if we ever get more than 1 touchscreen on a target */ | 585 | /* this needs to be fixed if we ever get more than 1 touchscreen on a target */ |
581 | unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct viewport *parent); | 586 | unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list); |
582 | #endif | 587 | #endif |
583 | 588 | ||
584 | bool gui_synclist_do_button(struct gui_synclist * lists, | 589 | bool gui_synclist_do_button(struct gui_synclist * lists, |
585 | unsigned *actionptr, enum list_wrap wrap) | 590 | int *actionptr, enum list_wrap wrap) |
586 | { | 591 | { |
587 | int action = *actionptr; | 592 | int action = *actionptr; |
588 | #ifdef HAVE_LCD_BITMAP | 593 | #ifdef HAVE_LCD_BITMAP |
@@ -621,7 +626,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, | |||
621 | 626 | ||
622 | #if defined(HAVE_TOUCHSCREEN) | 627 | #if defined(HAVE_TOUCHSCREEN) |
623 | if (action == ACTION_TOUCHSCREEN) | 628 | if (action == ACTION_TOUCHSCREEN) |
624 | action = *actionptr = gui_synclist_do_touchscreen(lists, &parent[SCREEN_MAIN]); | 629 | action = *actionptr = gui_synclist_do_touchscreen(lists); |
625 | #endif | 630 | #endif |
626 | 631 | ||
627 | switch (wrap) | 632 | switch (wrap) |
@@ -791,8 +796,8 @@ bool gui_synclist_item_is_onscreen(struct gui_synclist *lists, | |||
791 | { | 796 | { |
792 | struct viewport vp = *lists->parent[screen]; | 797 | struct viewport vp = *lists->parent[screen]; |
793 | #ifdef HAVE_LCD_BITMAP | 798 | #ifdef HAVE_LCD_BITMAP |
794 | if (list_display_title(lists, lists->parent[screen])) | 799 | if (list_display_title(lists, screen)) |
795 | vp.height -= list_title_height(lists, lists->parent[screen]); | 800 | vp.height -= font_get(lists->parent[screen]->font)->height; |
796 | #endif | 801 | #endif |
797 | return item <= (lists->start_item[screen] + viewport_get_nb_lines(&vp)); | 802 | return item <= (lists->start_item[screen] + viewport_get_nb_lines(&vp)); |
798 | } | 803 | } |
@@ -888,7 +893,6 @@ bool simplelist_show_list(struct simplelist_info *info) | |||
888 | 893 | ||
889 | while(1) | 894 | while(1) |
890 | { | 895 | { |
891 | gui_syncstatusbar_draw(&statusbars, true); | ||
892 | list_do_action(CONTEXT_STD, info->timeout, | 896 | list_do_action(CONTEXT_STD, info->timeout, |
893 | &lists, &action, wrap); | 897 | &lists, &action, wrap); |
894 | 898 | ||
@@ -900,14 +904,16 @@ bool simplelist_show_list(struct simplelist_info *info) | |||
900 | { | 904 | { |
901 | bool stdok = action==ACTION_STD_OK; | 905 | bool stdok = action==ACTION_STD_OK; |
902 | action = info->action_callback(action, &lists); | 906 | action = info->action_callback(action, &lists); |
903 | if (stdok && action == ACTION_STD_CANCEL) /* callback asked us to exit */ | 907 | if (stdok && action == ACTION_STD_CANCEL) |
904 | { | 908 | { |
909 | /* callback asked us to exit */ | ||
905 | info->selection = gui_synclist_get_sel_pos(&lists); | 910 | info->selection = gui_synclist_get_sel_pos(&lists); |
906 | break; | 911 | break; |
907 | } | 912 | } |
908 | 913 | ||
909 | if (info->get_name == NULL) | 914 | if (info->get_name == NULL) |
910 | gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size); | 915 | gui_synclist_set_nb_items(&lists, |
916 | simplelist_line_count*info->selection_size); | ||
911 | } | 917 | } |
912 | if (action == ACTION_STD_CANCEL) | 918 | if (action == ACTION_STD_CANCEL) |
913 | { | 919 | { |
@@ -918,7 +924,10 @@ bool simplelist_show_list(struct simplelist_info *info) | |||
918 | (old_line_count != simplelist_line_count)) | 924 | (old_line_count != simplelist_line_count)) |
919 | { | 925 | { |
920 | if (info->get_name == NULL) | 926 | if (info->get_name == NULL) |
921 | gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size); | 927 | { |
928 | gui_synclist_set_nb_items(&lists, | ||
929 | simplelist_line_count*info->selection_size); | ||
930 | } | ||
922 | gui_synclist_draw(&lists); | 931 | gui_synclist_draw(&lists); |
923 | old_line_count = simplelist_line_count; | 932 | old_line_count = simplelist_line_count; |
924 | } | 933 | } |
diff --git a/apps/gui/list.h b/apps/gui/list.h index 643f662f63..c1126f257f 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -179,7 +179,7 @@ extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists, | |||
179 | * NOTE: *action may be changed regardless of return value | 179 | * NOTE: *action may be changed regardless of return value |
180 | */ | 180 | */ |
181 | extern bool gui_synclist_do_button(struct gui_synclist * lists, | 181 | extern bool gui_synclist_do_button(struct gui_synclist * lists, |
182 | unsigned *action, | 182 | int *action, |
183 | enum list_wrap); | 183 | enum list_wrap); |
184 | 184 | ||
185 | /* If the list has a pending postponed scheduled announcement, that | 185 | /* If the list has a pending postponed scheduled announcement, that |
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 570a41a78d..30df8ea6ec 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c | |||
@@ -508,7 +508,6 @@ bool option_screen(const struct settings_list *setting, | |||
508 | gui_synclist_draw(&lists); | 508 | gui_synclist_draw(&lists); |
509 | /* talk the item */ | 509 | /* talk the item */ |
510 | gui_synclist_speak_item(&lists); | 510 | gui_synclist_speak_item(&lists); |
511 | gui_syncstatusbar_draw(&statusbars, false); | ||
512 | while (!done) | 511 | while (!done) |
513 | { | 512 | { |
514 | if (list_do_action(CONTEXT_LIST, TIMEOUT_BLOCK, | 513 | if (list_do_action(CONTEXT_LIST, TIMEOUT_BLOCK, |
@@ -562,7 +561,6 @@ bool option_screen(const struct settings_list *setting, | |||
562 | } | 561 | } |
563 | else if(default_event_handler(action) == SYS_USB_CONNECTED) | 562 | else if(default_event_handler(action) == SYS_USB_CONNECTED) |
564 | return true; | 563 | return true; |
565 | gui_syncstatusbar_draw(&statusbars, false); | ||
566 | /* callback */ | 564 | /* callback */ |
567 | if ( function ) | 565 | if ( function ) |
568 | function(*variable); | 566 | function(*variable); |
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index 7a05a57743..568bbf4aee 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -286,7 +286,6 @@ int gui_syncpitchscreen_run(void) | |||
286 | FOR_NB_SCREENS(i) | 286 | FOR_NB_SCREENS(i) |
287 | pitchscreen_draw(&screens[i], max_lines[i], | 287 | pitchscreen_draw(&screens[i], max_lines[i], |
288 | pitch_viewports[i], pitch); | 288 | pitch_viewports[i], pitch); |
289 | gui_syncstatusbar_draw(&statusbars, true); | ||
290 | button = get_action(CONTEXT_PITCHSCREEN,HZ); | 289 | button = get_action(CONTEXT_PITCHSCREEN,HZ); |
291 | switch (button) { | 290 | switch (button) { |
292 | case ACTION_PS_INC_SMALL: | 291 | case ACTION_PS_INC_SMALL: |
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 3880940ae3..a77453cf66 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -278,7 +278,6 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) | |||
278 | * - an action taken while pressing the enter button, | 278 | * - an action taken while pressing the enter button, |
279 | * then release the enter button*/ | 279 | * then release the enter button*/ |
280 | bool can_quit = false; | 280 | bool can_quit = false; |
281 | gui_syncstatusbar_draw(&statusbars, true); | ||
282 | FOR_NB_SCREENS(i) | 281 | FOR_NB_SCREENS(i) |
283 | { | 282 | { |
284 | screens[i].set_viewport(NULL); | 283 | screens[i].set_viewport(NULL); |
@@ -315,8 +314,6 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) | |||
315 | 314 | ||
316 | if(button==ACTION_STD_CANCEL) | 315 | if(button==ACTION_STD_CANCEL) |
317 | break; | 316 | break; |
318 | |||
319 | gui_syncstatusbar_draw(&statusbars, false); | ||
320 | } | 317 | } |
321 | /* Notify that we're exiting this screen */ | 318 | /* Notify that we're exiting this screen */ |
322 | cond_talk_ids_fq(VOICE_OK); | 319 | cond_talk_ids_fq(VOICE_OK); |
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index fc0b9637cf..29b80112f7 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "recording.h" | 43 | #include "recording.h" |
44 | #include "pcm_record.h" | 44 | #include "pcm_record.h" |
45 | #endif | 45 | #endif |
46 | #include "appevents.h" | ||
46 | 47 | ||
47 | /* FIXME: should be removed from icon.h to avoid redefinition, | 48 | /* FIXME: should be removed from icon.h to avoid redefinition, |
48 | but still needed for compatibility with old system */ | 49 | but still needed for compatibility with old system */ |
@@ -817,3 +818,8 @@ int gui_statusbar_height(void) | |||
817 | return global_settings.statusbar ? STATUSBAR_HEIGHT : 0; | 818 | return global_settings.statusbar ? STATUSBAR_HEIGHT : 0; |
818 | } | 819 | } |
819 | 820 | ||
821 | void gui_statusbar_changed(bool enabled) | ||
822 | { | ||
823 | (void)enabled; | ||
824 | send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL); | ||
825 | } | ||
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index f36d609bad..99acf9d006 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h | |||
@@ -99,4 +99,6 @@ struct gui_syncstatusbar | |||
99 | extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); | 99 | extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); |
100 | extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw); | 100 | extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw); |
101 | extern int gui_statusbar_height(void); | 101 | extern int gui_statusbar_height(void); |
102 | void gui_statusbar_changed(bool enabled); | ||
103 | |||
102 | #endif /*_GUI_STATUSBAR_H_*/ | 104 | #endif /*_GUI_STATUSBAR_H_*/ |
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index ef61494b71..9cd905fa14 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c | |||
@@ -33,6 +33,9 @@ | |||
33 | #include "viewport.h" | 33 | #include "viewport.h" |
34 | #include "statusbar.h" | 34 | #include "statusbar.h" |
35 | #include "screen_access.h" | 35 | #include "screen_access.h" |
36 | #include "appevents.h" | ||
37 | |||
38 | static bool statusbar_enabled = true; | ||
36 | 39 | ||
37 | int viewport_get_nb_lines(struct viewport *vp) | 40 | int viewport_get_nb_lines(struct viewport *vp) |
38 | { | 41 | { |
@@ -50,7 +53,7 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen) | |||
50 | vp->x = 0; | 53 | vp->x = 0; |
51 | vp->width = screens[screen].lcdwidth; | 54 | vp->width = screens[screen].lcdwidth; |
52 | 55 | ||
53 | vp->y = gui_statusbar_height(); | 56 | vp->y = statusbar_enabled?gui_statusbar_height():0; |
54 | vp->height = screens[screen].lcdheight - vp->y; | 57 | vp->height = screens[screen].lcdheight - vp->y; |
55 | #ifdef HAVE_LCD_BITMAP | 58 | #ifdef HAVE_LCD_BITMAP |
56 | vp->drawmode = DRMODE_SOLID; | 59 | vp->drawmode = DRMODE_SOLID; |
@@ -82,3 +85,31 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen) | |||
82 | } | 85 | } |
83 | #endif | 86 | #endif |
84 | } | 87 | } |
88 | |||
89 | |||
90 | void viewportmanager_set_statusbar(bool enabled) | ||
91 | { | ||
92 | if (enabled && global_settings.statusbar) | ||
93 | { | ||
94 | add_event(GUI_EVENT_FOURHERTZ, false, viewportmanager_draw_statusbars); | ||
95 | gui_syncstatusbar_draw(&statusbars, true); | ||
96 | } | ||
97 | else | ||
98 | { | ||
99 | remove_event(GUI_EVENT_FOURHERTZ, viewportmanager_draw_statusbars); | ||
100 | } | ||
101 | statusbar_enabled = enabled; | ||
102 | } | ||
103 | |||
104 | void viewportmanager_draw_statusbars(void* data) | ||
105 | { | ||
106 | (void)data; | ||
107 | if (statusbar_enabled) | ||
108 | gui_syncstatusbar_draw(&statusbars, false); | ||
109 | } | ||
110 | |||
111 | void viewportmanager_statusbar_changed(void* data) | ||
112 | { | ||
113 | (void)data; | ||
114 | viewportmanager_set_statusbar(statusbar_enabled); | ||
115 | } | ||
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h index 3605dbe711..cdb481017a 100644 --- a/apps/gui/viewport.h +++ b/apps/gui/viewport.h | |||
@@ -40,3 +40,9 @@ int viewport_get_nb_lines(struct viewport *vp); | |||
40 | int viewport_load_config(const char *config, struct viewport *vp); | 40 | int viewport_load_config(const char *config, struct viewport *vp); |
41 | 41 | ||
42 | void viewport_set_defaults(struct viewport *vp, enum screen_type screen); | 42 | void viewport_set_defaults(struct viewport *vp, enum screen_type screen); |
43 | |||
44 | void viewportmanager_set_statusbar(bool enabled); | ||
45 | /* callbacks for GUI_EVENT_* events */ | ||
46 | void viewportmanager_draw_statusbars(void*data); | ||
47 | void viewportmanager_statusbar_changed(void* data); | ||
48 | |||
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 297f7f8987..756d267c63 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c | |||
@@ -131,7 +131,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, | |||
131 | const struct text_message * no_message) | 131 | const struct text_message * no_message) |
132 | { | 132 | { |
133 | int i; | 133 | int i; |
134 | unsigned button; | 134 | int button; |
135 | int result=-1; | 135 | int result=-1; |
136 | bool result_displayed; | 136 | bool result_displayed; |
137 | struct gui_yesno yn[NB_SCREENS]; | 137 | struct gui_yesno yn[NB_SCREENS]; |
diff --git a/apps/main.c b/apps/main.c index 45e6c77801..c62ee080b3 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -121,6 +121,16 @@ const char appsversion[]=APPSVERSION; | |||
121 | 121 | ||
122 | static void init(void); | 122 | static void init(void); |
123 | 123 | ||
124 | void fourhertz_tick_task(void) | ||
125 | { | ||
126 | static long last_fire = 0; | ||
127 | if (TIME_AFTER(current_tick, last_fire+HZ/4)) | ||
128 | { | ||
129 | queue_post(&button_queue, SYS_FOURHERTZ, 0); | ||
130 | last_fire = current_tick; | ||
131 | } | ||
132 | } | ||
133 | |||
124 | #ifdef SIMULATOR | 134 | #ifdef SIMULATOR |
125 | void app_main(void) | 135 | void app_main(void) |
126 | #else | 136 | #else |
@@ -138,6 +148,10 @@ static void app_main(void) | |||
138 | #ifdef HAVE_TOUCHSCREEN | 148 | #ifdef HAVE_TOUCHSCREEN |
139 | touchscreen_set_mode(TOUCHSCREEN_BUTTON); | 149 | touchscreen_set_mode(TOUCHSCREEN_BUTTON); |
140 | #endif | 150 | #endif |
151 | tick_add_task(fourhertz_tick_task); | ||
152 | viewportmanager_set_statusbar(true); | ||
153 | add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, | ||
154 | viewportmanager_statusbar_changed); | ||
141 | root_menu(); | 155 | root_menu(); |
142 | } | 156 | } |
143 | 157 | ||
diff --git a/apps/menu.c b/apps/menu.c index a0317e4a84..b5309a047e 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -283,29 +283,6 @@ static int talk_menu_item(int selected_item, void *data) | |||
283 | } | 283 | } |
284 | return 0; | 284 | return 0; |
285 | } | 285 | } |
286 | /* this is used to reload the default menu viewports when the | ||
287 | theme changes. nothing happens if the menu is using a supplied parent vp */ | ||
288 | static void init_default_menu_viewports(struct viewport parent[NB_SCREENS], bool hide_bars) | ||
289 | { | ||
290 | int i; | ||
291 | FOR_NB_SCREENS(i) | ||
292 | { | ||
293 | viewport_set_defaults(&parent[i], i); | ||
294 | /* viewport_set_defaults() fixes the vp for the bars, so resize */ | ||
295 | if (hide_bars) | ||
296 | { | ||
297 | if (global_settings.statusbar) | ||
298 | { | ||
299 | parent[i].y -= STATUSBAR_HEIGHT; | ||
300 | parent[i].height += STATUSBAR_HEIGHT; | ||
301 | } | ||
302 | } | ||
303 | } | ||
304 | #ifdef HAVE_BUTTONBAR | ||
305 | if (!hide_bars && global_settings.buttonbar) | ||
306 | parent[0].height -= BUTTONBAR_HEIGHT; | ||
307 | #endif | ||
308 | } | ||
309 | 286 | ||
310 | bool do_setting_from_menu(const struct menu_item_ex *temp, | 287 | bool do_setting_from_menu(const struct menu_item_ex *temp, |
311 | struct viewport parent[NB_SCREENS]) | 288 | struct viewport parent[NB_SCREENS]) |
@@ -383,8 +360,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
383 | int menu_stack_selected_item[MAX_MENUS]; | 360 | int menu_stack_selected_item[MAX_MENUS]; |
384 | int stack_top = 0; | 361 | int stack_top = 0; |
385 | bool in_stringlist, done = false; | 362 | bool in_stringlist, done = false; |
386 | 363 | struct viewport *vps = NULL; | |
387 | struct viewport *vps, menu_vp[NB_SCREENS]; /* menu_vp will hopefully be phased out */ | ||
388 | #ifdef HAVE_BUTTONBAR | 364 | #ifdef HAVE_BUTTONBAR |
389 | struct gui_buttonbar buttonbar; | 365 | struct gui_buttonbar buttonbar; |
390 | gui_buttonbar_init(&buttonbar); | 366 | gui_buttonbar_init(&buttonbar); |
@@ -396,27 +372,12 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
396 | if (start_menu == NULL) | 372 | if (start_menu == NULL) |
397 | menu = &main_menu_; | 373 | menu = &main_menu_; |
398 | else menu = start_menu; | 374 | else menu = start_menu; |
399 | 375 | ||
400 | init_default_menu_viewports(menu_vp, hide_bars); | 376 | /* if hide_bars is true, assume parent has been fixed before passed into |
401 | 377 | * this function, e.g. with viewport_set_defaults(parent, screen, true) */ | |
402 | if (parent) | 378 | init_menu_lists(menu, &lists, selected, true, parent); |
403 | { | 379 | vps = *(lists.parent); |
404 | vps = parent; | ||
405 | /* if hide_bars == true we assume the viewport is correctly sized */ | ||
406 | } | ||
407 | else | ||
408 | { | ||
409 | vps = menu_vp; | ||
410 | } | ||
411 | FOR_NB_SCREENS(i) | ||
412 | { | ||
413 | screens[i].set_viewport(&vps[i]); | ||
414 | screens[i].clear_viewport(); | ||
415 | screens[i].set_viewport(NULL); | ||
416 | } | ||
417 | init_menu_lists(menu, &lists, selected, true, vps); | ||
418 | in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID); | 380 | in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID); |
419 | |||
420 | /* load the callback, and only reload it if menu changes */ | 381 | /* load the callback, and only reload it if menu changes */ |
421 | get_menu_callback(menu, &menu_callback); | 382 | get_menu_callback(menu, &menu_callback); |
422 | 383 | ||
@@ -436,7 +397,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
436 | #ifdef HAVE_BUTTONBAR | 397 | #ifdef HAVE_BUTTONBAR |
437 | gui_buttonbar_draw(&buttonbar); | 398 | gui_buttonbar_draw(&buttonbar); |
438 | #endif | 399 | #endif |
439 | gui_syncstatusbar_draw(&statusbars, true); | ||
440 | } | 400 | } |
441 | action = get_action(CONTEXT_MAINMENU, | 401 | action = get_action(CONTEXT_MAINMENU, |
442 | list_do_action_timeout(&lists, HZ)); | 402 | list_do_action_timeout(&lists, HZ)); |
@@ -496,7 +456,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
496 | else if (!in_stringlist) | 456 | else if (!in_stringlist) |
497 | { | 457 | { |
498 | int type; | 458 | int type; |
499 | selected = get_menu_selection(gui_synclist_get_sel_pos(&lists), menu); | 459 | selected = get_menu_selection(gui_synclist_get_sel_pos(&lists),menu); |
500 | temp = menu->submenus[selected]; | 460 | temp = menu->submenus[selected]; |
501 | type = (temp->flags&MENU_TYPE_MASK); | 461 | type = (temp->flags&MENU_TYPE_MASK); |
502 | if ((type == MT_SETTING_W_TEXT || type == MT_SETTING)) | 462 | if ((type == MT_SETTING_W_TEXT || type == MT_SETTING)) |
@@ -640,9 +600,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
640 | temp->function->param); | 600 | temp->function->param); |
641 | else | 601 | else |
642 | return_value = temp->function->function(); | 602 | return_value = temp->function->function(); |
643 | if (!(menu->flags&MENU_EXITAFTERTHISMENU) || (temp->flags&MENU_EXITAFTERTHISMENU)) | 603 | if (!(menu->flags&MENU_EXITAFTERTHISMENU) || |
604 | (temp->flags&MENU_EXITAFTERTHISMENU)) | ||
644 | { | 605 | { |
645 | init_default_menu_viewports(menu_vp, hide_bars); | ||
646 | init_menu_lists(menu, &lists, selected, true, vps); | 606 | init_menu_lists(menu, &lists, selected, true, vps); |
647 | } | 607 | } |
648 | if (temp->flags&MENU_FUNC_CHECK_RETVAL) | 608 | if (temp->flags&MENU_FUNC_CHECK_RETVAL) |
@@ -658,9 +618,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
658 | case MT_SETTING: | 618 | case MT_SETTING: |
659 | case MT_SETTING_W_TEXT: | 619 | case MT_SETTING_W_TEXT: |
660 | { | 620 | { |
661 | if (do_setting_from_menu(temp, menu_vp)) | 621 | if (do_setting_from_menu(temp, vps)) |
662 | { | 622 | { |
663 | init_default_menu_viewports(menu_vp, hide_bars); | ||
664 | init_menu_lists(menu, &lists, selected, true,vps); | 623 | init_menu_lists(menu, &lists, selected, true,vps); |
665 | redraw_lists = false; /* above does the redraw */ | 624 | redraw_lists = false; /* above does the redraw */ |
666 | } | 625 | } |
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index b22824d8bd..8611a66397 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c | |||
@@ -117,7 +117,8 @@ static bool show_credits(void) | |||
117 | { | 117 | { |
118 | /* show the rockbox logo and version untill a button is pressed */ | 118 | /* show the rockbox logo and version untill a button is pressed */ |
119 | show_logo(); | 119 | show_logo(); |
120 | get_action(CONTEXT_STD, TIMEOUT_BLOCK); | 120 | while (IS_SYSEVENT(get_action(CONTEXT_STD, TIMEOUT_BLOCK))) |
121 | ; | ||
121 | } | 122 | } |
122 | return false; | 123 | return false; |
123 | } | 124 | } |
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c index 3b5a25ebc0..b9f5f7be78 100644 --- a/apps/menus/recording_menu.c +++ b/apps/menus/recording_menu.c | |||
@@ -537,7 +537,6 @@ int rectrigger(void) | |||
537 | if (changed) | 537 | if (changed) |
538 | { | 538 | { |
539 | gui_synclist_draw(&lists); | 539 | gui_synclist_draw(&lists); |
540 | gui_syncstatusbar_draw(&statusbars, true); | ||
541 | peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF); | 540 | peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF); |
542 | settings_apply_trigger(); | 541 | settings_apply_trigger(); |
543 | changed = false; | 542 | changed = false; |
diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c index cb1a93c28e..6d5abed622 100644 --- a/apps/menus/time_menu.c +++ b/apps/menus/time_menu.c | |||
@@ -295,9 +295,7 @@ int time_screen(void* ignored) | |||
295 | if (global_settings.buttonbar) | 295 | if (global_settings.buttonbar) |
296 | menu[i].height -= BUTTONBAR_HEIGHT; | 296 | menu[i].height -= BUTTONBAR_HEIGHT; |
297 | #endif | 297 | #endif |
298 | screens[i].clear_display(); | ||
299 | draw_timedate(&clock[i], &screens[i]); | 298 | draw_timedate(&clock[i], &screens[i]); |
300 | screens[i].update(); | ||
301 | } | 299 | } |
302 | ret = do_menu(&time_menu, NULL, menu, false); | 300 | ret = do_menu(&time_menu, NULL, menu, false); |
303 | /* see comments above in the button callback */ | 301 | /* see comments above in the button callback */ |
diff --git a/apps/misc.c b/apps/misc.c index 8b73411549..894b0c2cc4 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #endif | 33 | #endif |
34 | #else | 34 | #else |
35 | #include "sprintf.h" | 35 | #include "sprintf.h" |
36 | #include "appevents.h" | ||
36 | #include "lang.h" | 37 | #include "lang.h" |
37 | #include "string.h" | 38 | #include "string.h" |
38 | #include "dir.h" | 39 | #include "dir.h" |
@@ -60,6 +61,7 @@ | |||
60 | #include "sound.h" | 61 | #include "sound.h" |
61 | #include "playlist.h" | 62 | #include "playlist.h" |
62 | #include "yesno.h" | 63 | #include "yesno.h" |
64 | #include "viewport.h" | ||
63 | 65 | ||
64 | #ifdef IPOD_ACCESSORY_PROTOCOL | 66 | #ifdef IPOD_ACCESSORY_PROTOCOL |
65 | #include "iap.h" | 67 | #include "iap.h" |
@@ -904,6 +906,9 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame | |||
904 | { | 906 | { |
905 | switch(event) | 907 | switch(event) |
906 | { | 908 | { |
909 | case SYS_FOURHERTZ: | ||
910 | send_event(GUI_EVENT_FOURHERTZ, NULL); | ||
911 | break; | ||
907 | case SYS_BATTERY_UPDATE: | 912 | case SYS_BATTERY_UPDATE: |
908 | if(global_settings.talk_battery_level) | 913 | if(global_settings.talk_battery_level) |
909 | { | 914 | { |
diff --git a/apps/onplay.c b/apps/onplay.c index 42924a18a0..7c89e6320f 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -212,7 +212,6 @@ static bool add_to_playlist(int position, bool queue) | |||
212 | if (global_settings.playlist_shuffle) | 212 | if (global_settings.playlist_shuffle) |
213 | playlist_shuffle(current_tick, -1); | 213 | playlist_shuffle(current_tick, -1); |
214 | playlist_start(0,0); | 214 | playlist_start(0,0); |
215 | gui_syncstatusbar_draw(&statusbars, false); | ||
216 | onplay_result = ONPLAY_START_PLAY; | 215 | onplay_result = ONPLAY_START_PLAY; |
217 | } | 216 | } |
218 | 217 | ||
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 7daae15552..105c3e0e83 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c | |||
@@ -295,10 +295,6 @@ static int display_playlists(char* playlist, bool view) | |||
295 | } | 295 | } |
296 | break; | 296 | break; |
297 | 297 | ||
298 | case ACTION_NONE: | ||
299 | gui_syncstatusbar_draw(&statusbars, false); | ||
300 | break; | ||
301 | |||
302 | default: | 298 | default: |
303 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 299 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
304 | { | 300 | { |
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 2acc02abe4..30dcfd0a1c 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -746,10 +746,6 @@ bool playlist_viewer_ex(const char* filename) | |||
746 | gui_synclist_draw(&playlist_lists); | 746 | gui_synclist_draw(&playlist_lists); |
747 | break; | 747 | break; |
748 | 748 | ||
749 | case ACTION_NONE: | ||
750 | gui_syncstatusbar_draw(&statusbars, false); | ||
751 | break; | ||
752 | |||
753 | default: | 749 | default: |
754 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 750 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
755 | { | 751 | { |
@@ -834,7 +830,6 @@ bool search_playlist(void) | |||
834 | gui_synclist_draw(&playlist_lists); | 830 | gui_synclist_draw(&playlist_lists); |
835 | while (!exit) | 831 | while (!exit) |
836 | { | 832 | { |
837 | gui_syncstatusbar_draw(&statusbars, false); | ||
838 | button = get_action(CONTEXT_LIST, HZ/4); | 833 | button = get_action(CONTEXT_LIST, HZ/4); |
839 | if (gui_synclist_do_button(&playlist_lists, &button, LIST_WRAP_UNLESS_HELD)) | 834 | if (gui_synclist_do_button(&playlist_lists, &button, LIST_WRAP_UNLESS_HELD)) |
840 | continue; | 835 | continue; |
diff --git a/apps/plugin.c b/apps/plugin.c index f78b6bf4e1..5e02d33a95 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -621,6 +621,7 @@ static const struct plugin_api rockbox_api = { | |||
621 | appsversion, | 621 | appsversion, |
622 | /* new stuff at the end, sort into place next time | 622 | /* new stuff at the end, sort into place next time |
623 | the API gets incompatible */ | 623 | the API gets incompatible */ |
624 | viewportmanager_set_statusbar, | ||
624 | }; | 625 | }; |
625 | 626 | ||
626 | int plugin_load(const char* plugin, const void* parameter) | 627 | int plugin_load(const char* plugin, const void* parameter) |
@@ -731,8 +732,11 @@ int plugin_load(const char* plugin, const void* parameter) | |||
731 | #endif | 732 | #endif |
732 | 733 | ||
733 | invalidate_icache(); | 734 | invalidate_icache(); |
735 | viewportmanager_set_statusbar(false); | ||
734 | 736 | ||
735 | rc = hdr->entry_point(&rockbox_api, parameter); | 737 | rc = hdr->entry_point(&rockbox_api, parameter); |
738 | |||
739 | viewportmanager_set_statusbar(true); | ||
736 | 740 | ||
737 | button_clear_queue(); | 741 | button_clear_queue(); |
738 | 742 | ||
diff --git a/apps/plugin.h b/apps/plugin.h index 81c069666a..440541d510 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 Björn Stenberg | 10 | * Copyright (C) 2002 Bj�rn Stenberg |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
@@ -132,7 +132,7 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
132 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 132 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
133 | 133 | ||
134 | /* increase this every time the api struct changes */ | 134 | /* increase this every time the api struct changes */ |
135 | #define PLUGIN_API_VERSION 131 | 135 | #define PLUGIN_API_VERSION 132 |
136 | 136 | ||
137 | /* update this to latest version if a change to the api struct breaks | 137 | /* update this to latest version if a change to the api struct breaks |
138 | backwards compatibility (and please take the opportunity to sort in any | 138 | backwards compatibility (and please take the opportunity to sort in any |
@@ -334,7 +334,7 @@ struct plugin_api { | |||
334 | void (*gui_synclist_del_item)(struct gui_synclist * lists); | 334 | void (*gui_synclist_del_item)(struct gui_synclist * lists); |
335 | void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll); | 335 | void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll); |
336 | bool (*gui_synclist_do_button)(struct gui_synclist * lists, | 336 | bool (*gui_synclist_do_button)(struct gui_synclist * lists, |
337 | unsigned *action, enum list_wrap wrap); | 337 | int *action, enum list_wrap wrap); |
338 | void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, int icon); | 338 | void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, int icon); |
339 | enum yesno_res (*gui_syncyesno_run)(const struct text_message * main_message, | 339 | enum yesno_res (*gui_syncyesno_run)(const struct text_message * main_message, |
340 | const struct text_message * yes_message, | 340 | const struct text_message * yes_message, |
@@ -785,6 +785,7 @@ struct plugin_api { | |||
785 | const char *appsversion; | 785 | const char *appsversion; |
786 | /* new stuff at the end, sort into place next time | 786 | /* new stuff at the end, sort into place next time |
787 | the API gets incompatible */ | 787 | the API gets incompatible */ |
788 | void (*viewportmanager_set_statusbar)(bool enabled); | ||
788 | }; | 789 | }; |
789 | 790 | ||
790 | /* plugin header */ | 791 | /* plugin header */ |
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 17b98c7f56..55771de919 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c | |||
@@ -674,7 +674,6 @@ static bool view_events(int selected, struct shown *shown) | |||
674 | 674 | ||
675 | while (!exit) | 675 | while (!exit) |
676 | { | 676 | { |
677 | rb->gui_syncstatusbar_draw(rb->statusbars, true); | ||
678 | button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK); | 677 | button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK); |
679 | rb->gui_synclist_do_button(&gui_memos,&button,LIST_WRAP_UNLESS_HELD); | 678 | rb->gui_synclist_do_button(&gui_memos,&button,LIST_WRAP_UNLESS_HELD); |
680 | 679 | ||
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index 1aff214332..8c92573b75 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c | |||
@@ -640,7 +640,6 @@ struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api, | |||
640 | rb->gui_synclist_select_item(&games_list, 0); | 640 | rb->gui_synclist_select_item(&games_list, 0); |
641 | 641 | ||
642 | while (true) { | 642 | while (true) { |
643 | rb->gui_syncstatusbar_draw(rb->statusbars, true); | ||
644 | rb->gui_synclist_draw(&games_list); | 643 | rb->gui_synclist_draw(&games_list); |
645 | curr_selection = rb->gui_synclist_get_sel_pos(&games_list); | 644 | curr_selection = rb->gui_synclist_get_sel_pos(&games_list); |
646 | button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK); | 645 | button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK); |
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index dae413ccbc..6ec86f6950 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c | |||
@@ -556,7 +556,6 @@ static int keybox(void) | |||
556 | 556 | ||
557 | while (!done) | 557 | while (!done) |
558 | { | 558 | { |
559 | rb->gui_syncstatusbar_draw(rb->statusbars, true); | ||
560 | rb->gui_synclist_draw(&kb_list); | 559 | rb->gui_synclist_draw(&kb_list); |
561 | button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK); | 560 | button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK); |
562 | if (rb->gui_synclist_do_button(&kb_list, &button, LIST_WRAP_ON)) | 561 | if (rb->gui_synclist_do_button(&kb_list, &button, LIST_WRAP_ON)) |
diff --git a/apps/plugins/lib/oldmenuapi.c b/apps/plugins/lib/oldmenuapi.c index b83f926532..a48a61bca6 100644 --- a/apps/plugins/lib/oldmenuapi.c +++ b/apps/plugins/lib/oldmenuapi.c | |||
@@ -98,7 +98,6 @@ int menu_show(int m) | |||
98 | int key; | 98 | int key; |
99 | 99 | ||
100 | rb->gui_synclist_draw(&(menus[m].synclist)); | 100 | rb->gui_synclist_draw(&(menus[m].synclist)); |
101 | rb->gui_syncstatusbar_draw(rb->statusbars, true); | ||
102 | while (!exit) { | 101 | while (!exit) { |
103 | key = rb->get_action(CONTEXT_MAINMENU,HZ/2); | 102 | key = rb->get_action(CONTEXT_MAINMENU,HZ/2); |
104 | /* | 103 | /* |
@@ -126,7 +125,6 @@ int menu_show(int m) | |||
126 | return MENU_ATTACHED_USB; | 125 | return MENU_ATTACHED_USB; |
127 | break; | 126 | break; |
128 | } | 127 | } |
129 | rb->gui_syncstatusbar_draw(rb->statusbars, false); | ||
130 | } | 128 | } |
131 | return MENU_SELECTED_EXIT; | 129 | return MENU_SELECTED_EXIT; |
132 | } | 130 | } |
@@ -149,7 +147,6 @@ bool menu_run(int m) | |||
149 | if (menus[m].items[selected].function && | 147 | if (menus[m].items[selected].function && |
150 | menus[m].items[selected].function()) | 148 | menus[m].items[selected].function()) |
151 | return true; | 149 | return true; |
152 | rb->gui_syncstatusbar_draw(rb->statusbars, true); | ||
153 | } | 150 | } |
154 | } | 151 | } |
155 | } | 152 | } |
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c index 09b25480e8..eb3cb9506c 100644 --- a/apps/plugins/shortcuts/shortcuts_view.c +++ b/apps/plugins/shortcuts/shortcuts_view.c | |||
@@ -58,8 +58,6 @@ enum sc_list_action_type draw_sc_list(struct gui_synclist gui_sc) | |||
58 | rb->gui_synclist_draw(&gui_sc); | 58 | rb->gui_synclist_draw(&gui_sc); |
59 | 59 | ||
60 | while (true) { | 60 | while (true) { |
61 | /* draw the statusbar, should be done often */ | ||
62 | rb->gui_syncstatusbar_draw(rb->statusbars, true); | ||
63 | /* user input */ | 61 | /* user input */ |
64 | button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK); | 62 | button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK); |
65 | if (rb->gui_synclist_do_button(&gui_sc, &button, | 63 | if (rb->gui_synclist_do_button(&gui_sc, &button, |
diff --git a/apps/plugins/star.c b/apps/plugins/star.c index f358755e2a..c217fb922f 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c | |||
@@ -1008,9 +1008,6 @@ static int star_menu(void) | |||
1008 | FOR_NB_SCREENS(selection) | 1008 | FOR_NB_SCREENS(selection) |
1009 | { | 1009 | { |
1010 | rb->viewport_set_defaults(&vp[selection], selection); | 1010 | rb->viewport_set_defaults(&vp[selection], selection); |
1011 | /* we are hiding the statusbar so fix the height also */ | ||
1012 | vp[selection].y = 0; | ||
1013 | vp[selection].height = rb->screens[selection]->lcdheight; | ||
1014 | #if LCD_DEPTH > 1 | 1011 | #if LCD_DEPTH > 1 |
1015 | if (rb->screens[selection]->depth > 1) | 1012 | if (rb->screens[selection]->depth > 1) |
1016 | { | 1013 | { |
@@ -1112,7 +1109,6 @@ static int star_menu(void) | |||
1112 | level--; | 1109 | level--; |
1113 | star_run_game(level); | 1110 | star_run_game(level); |
1114 | } | 1111 | } |
1115 | |||
1116 | return PLUGIN_OK; | 1112 | return PLUGIN_OK; |
1117 | } | 1113 | } |
1118 | 1114 | ||
diff --git a/apps/plugins/zxbox/zxbox_keyb.c b/apps/plugins/zxbox/zxbox_keyb.c index 7ae3862fc2..36f1d519d9 100644 --- a/apps/plugins/zxbox/zxbox_keyb.c +++ b/apps/plugins/zxbox/zxbox_keyb.c | |||
@@ -443,8 +443,6 @@ int zx_kbd_input(char* text/*, int buflen*/) | |||
443 | rb->screens[l]->set_drawmode(DRMODE_SOLID); | 443 | rb->screens[l]->set_drawmode(DRMODE_SOLID); |
444 | } | 444 | } |
445 | 445 | ||
446 | |||
447 | /* gui_syncstatusbar_draw(&statusbars, true);*/ | ||
448 | FOR_NB_SCREENS(l) | 446 | FOR_NB_SCREENS(l) |
449 | rb->screens[l]->update(); | 447 | rb->screens[l]->update(); |
450 | 448 | ||
@@ -554,10 +552,6 @@ int zx_kbd_input(char* text/*, int buflen*/) | |||
554 | } | 552 | } |
555 | break; | 553 | break; |
556 | 554 | ||
557 | case BUTTON_NONE: | ||
558 | /*gui_syncstatusbar_draw(&statusbars, false);*/ | ||
559 | |||
560 | break; | ||
561 | 555 | ||
562 | default: | 556 | default: |
563 | if(rb->default_event_handler(button) == SYS_USB_CONNECTED) | 557 | if(rb->default_event_handler(button) == SYS_USB_CONNECTED) |
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index f72def6a8a..26413e99da 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -743,7 +743,6 @@ int kbd_input(char* text, int buflen) | |||
743 | sc->set_drawmode(DRMODE_SOLID); | 743 | sc->set_drawmode(DRMODE_SOLID); |
744 | } | 744 | } |
745 | 745 | ||
746 | gui_syncstatusbar_draw(&statusbars, true); | ||
747 | FOR_NB_SCREENS(l) | 746 | FOR_NB_SCREENS(l) |
748 | screens[l].update(); | 747 | screens[l].update(); |
749 | 748 | ||
@@ -1190,7 +1189,6 @@ int kbd_input(char* text, int buflen) | |||
1190 | #endif /* !defined (KBD_MODES) || defined (KBD_CURSOR_KEYS) */ | 1189 | #endif /* !defined (KBD_MODES) || defined (KBD_CURSOR_KEYS) */ |
1191 | 1190 | ||
1192 | case BUTTON_NONE: | 1191 | case BUTTON_NONE: |
1193 | gui_syncstatusbar_draw(&statusbars, false); | ||
1194 | #ifdef KBD_MORSE_INPUT | 1192 | #ifdef KBD_MORSE_INPUT |
1195 | if (morse_reading) | 1193 | if (morse_reading) |
1196 | { | 1194 | { |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index a6213abfb1..d01d24ccf2 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -489,7 +489,6 @@ int radio_screen(void) | |||
489 | /* always display status bar in radio screen for now */ | 489 | /* always display status bar in radio screen for now */ |
490 | global_status.statusbar_forced = statusbar?0:1; | 490 | global_status.statusbar_forced = statusbar?0:1; |
491 | global_settings.statusbar = true; | 491 | global_settings.statusbar = true; |
492 | gui_syncstatusbar_draw(&statusbars,true); | ||
493 | FOR_NB_SCREENS(i) | 492 | FOR_NB_SCREENS(i) |
494 | { | 493 | { |
495 | viewport_set_defaults(&vp[i], i); | 494 | viewport_set_defaults(&vp[i], i); |
@@ -986,8 +985,6 @@ int radio_screen(void) | |||
986 | gui_buttonbar_draw(&buttonbar); | 985 | gui_buttonbar_draw(&buttonbar); |
987 | #endif | 986 | #endif |
988 | } | 987 | } |
989 | /* Only force the redraw if update_screen is true */ | ||
990 | gui_syncstatusbar_draw(&statusbars,true); | ||
991 | } | 988 | } |
992 | 989 | ||
993 | update_screen = false; | 990 | update_screen = false; |
@@ -1027,7 +1024,6 @@ int radio_screen(void) | |||
1027 | if(audio_status() & AUDIO_STATUS_ERROR) | 1024 | if(audio_status() & AUDIO_STATUS_ERROR) |
1028 | { | 1025 | { |
1029 | splash(0, str(LANG_DISK_FULL)); | 1026 | splash(0, str(LANG_DISK_FULL)); |
1030 | gui_syncstatusbar_draw(&statusbars,true); | ||
1031 | FOR_NB_SCREENS(i) | 1027 | FOR_NB_SCREENS(i) |
1032 | { | 1028 | { |
1033 | screens[i].set_viewport(&vp[i]); | 1029 | screens[i].set_viewport(&vp[i]); |
@@ -1397,7 +1393,6 @@ static int handle_radio_presets(void) | |||
1397 | while (result == 0) | 1393 | while (result == 0) |
1398 | { | 1394 | { |
1399 | gui_synclist_draw(&lists); | 1395 | gui_synclist_draw(&lists); |
1400 | gui_syncstatusbar_draw(&statusbars, true); | ||
1401 | list_do_action(CONTEXT_STD, TIMEOUT_BLOCK, | 1396 | list_do_action(CONTEXT_STD, TIMEOUT_BLOCK, |
1402 | &lists, &action, LIST_WRAP_UNLESS_HELD); | 1397 | &lists, &action, LIST_WRAP_UNLESS_HELD); |
1403 | switch (action) | 1398 | switch (action) |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index a8586b9735..bdf30212f7 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -1038,7 +1038,6 @@ bool recording_screen(bool no_source) | |||
1038 | bool statusbar = global_settings.statusbar; | 1038 | bool statusbar = global_settings.statusbar; |
1039 | global_status.statusbar_forced = statusbar?0:1; | 1039 | global_status.statusbar_forced = statusbar?0:1; |
1040 | global_settings.statusbar = true; | 1040 | global_settings.statusbar = true; |
1041 | gui_syncstatusbar_draw(&statusbars,true); | ||
1042 | #endif | 1041 | #endif |
1043 | 1042 | ||
1044 | static const unsigned char *byte_units[] = { | 1043 | static const unsigned char *byte_units[] = { |
@@ -1102,7 +1101,7 @@ bool recording_screen(bool no_source) | |||
1102 | /* top vp, 4 lines, force sys font if total screen < 6 lines | 1101 | /* top vp, 4 lines, force sys font if total screen < 6 lines |
1103 | NOTE: one could limit the list to 1 line and get away with 5 lines */ | 1102 | NOTE: one could limit the list to 1 line and get away with 5 lines */ |
1104 | v = &vp_top[i]; | 1103 | v = &vp_top[i]; |
1105 | viewport_set_defaults(v, i); /*already takes care of statusbar*/ | 1104 | viewport_set_defaults(v, i); |
1106 | if (viewport_get_nb_lines(v) < 4) | 1105 | if (viewport_get_nb_lines(v) < 4) |
1107 | { | 1106 | { |
1108 | /* compact needs 4 lines total */ | 1107 | /* compact needs 4 lines total */ |
@@ -1864,7 +1863,6 @@ bool recording_screen(bool no_source) | |||
1864 | /* draw peakmeter again (check if this can be removed) */ | 1863 | /* draw peakmeter again (check if this can be removed) */ |
1865 | FOR_NB_ACTIVE_SCREENS(i) | 1864 | FOR_NB_ACTIVE_SCREENS(i) |
1866 | { | 1865 | { |
1867 | screens[i].set_viewport(NULL); | ||
1868 | gui_statusbar_draw(&(statusbars.statusbars[i]), true); | 1866 | gui_statusbar_draw(&(statusbars.statusbars[i]), true); |
1869 | screens[i].set_viewport(&vp_top[i]); | 1867 | screens[i].set_viewport(&vp_top[i]); |
1870 | peak_meter_screen(&screens[i], pm_x[i], pm_y[i], pm_h[i]); | 1868 | peak_meter_screen(&screens[i], pm_x[i], pm_y[i], pm_h[i]); |
@@ -1882,7 +1880,6 @@ bool recording_screen(bool no_source) | |||
1882 | if (audio_stat & AUDIO_STATUS_ERROR) | 1880 | if (audio_stat & AUDIO_STATUS_ERROR) |
1883 | { | 1881 | { |
1884 | splash(0, str(LANG_DISK_FULL)); | 1882 | splash(0, str(LANG_DISK_FULL)); |
1885 | gui_syncstatusbar_draw(&statusbars, true); | ||
1886 | 1883 | ||
1887 | FOR_NB_SCREENS(i) | 1884 | FOR_NB_SCREENS(i) |
1888 | screens[i].update(); | 1885 | screens[i].update(); |
diff --git a/apps/root_menu.c b/apps/root_menu.c index 9d4f256370..3b0907f00a 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "buttonbar.h" | 46 | #include "buttonbar.h" |
47 | #include "action.h" | 47 | #include "action.h" |
48 | #include "yesno.h" | 48 | #include "yesno.h" |
49 | #include "viewport.h" | ||
49 | 50 | ||
50 | #include "tree.h" | 51 | #include "tree.h" |
51 | #if CONFIG_TUNER | 52 | #if CONFIG_TUNER |
@@ -117,7 +118,6 @@ static int browser(void* param) | |||
117 | /* Now display progress until it's ready or the user exits */ | 118 | /* Now display progress until it's ready or the user exits */ |
118 | while(!tagcache_is_usable()) | 119 | while(!tagcache_is_usable()) |
119 | { | 120 | { |
120 | gui_syncstatusbar_draw(&statusbars, false); | ||
121 | struct tagcache_stat *stat = tagcache_get_stat(); | 121 | struct tagcache_stat *stat = tagcache_get_stat(); |
122 | 122 | ||
123 | /* Allow user to exit */ | 123 | /* Allow user to exit */ |
@@ -262,6 +262,8 @@ static int wpsscrn(void* param) | |||
262 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 | 262 | #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 |
263 | show_remote_main_backdrop(); | 263 | show_remote_main_backdrop(); |
264 | #endif | 264 | #endif |
265 | /* always re-enable the statusbar after the WPS */ | ||
266 | viewportmanager_set_statusbar(true); | ||
265 | return ret_val; | 267 | return ret_val; |
266 | } | 268 | } |
267 | #if CONFIG_TUNER | 269 | #if CONFIG_TUNER |
diff --git a/apps/screens.c b/apps/screens.c index 230e9ae53c..8a787a5ca1 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -138,7 +138,6 @@ void usb_screen(void) | |||
138 | screens[i].update(); | 138 | screens[i].update(); |
139 | } | 139 | } |
140 | 140 | ||
141 | gui_syncstatusbar_draw(&statusbars, true); | ||
142 | #ifdef SIMULATOR | 141 | #ifdef SIMULATOR |
143 | while (button_get(true) & BUTTON_REL); | 142 | while (button_get(true) & BUTTON_REL); |
144 | #else | 143 | #else |
@@ -355,7 +354,6 @@ int charging_screen(void) | |||
355 | remote_backlight_set_timeout(global_settings.remote_backlight_timeout); | 354 | remote_backlight_set_timeout(global_settings.remote_backlight_timeout); |
356 | #endif | 355 | #endif |
357 | backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged); | 356 | backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged); |
358 | gui_syncstatusbar_draw(&statusbars, true); | ||
359 | 357 | ||
360 | #ifdef HAVE_LCD_CHARCELLS | 358 | #ifdef HAVE_LCD_CHARCELLS |
361 | logo_lock_patterns(true); | 359 | logo_lock_patterns(true); |
@@ -584,7 +582,6 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
584 | screens[s].update_viewport(); | 582 | screens[s].update_viewport(); |
585 | screens[s].set_viewport(NULL); | 583 | screens[s].set_viewport(NULL); |
586 | } | 584 | } |
587 | gui_syncstatusbar_draw(&statusbars, true); | ||
588 | 585 | ||
589 | /* set the most common numbers */ | 586 | /* set the most common numbers */ |
590 | min = 0; | 587 | min = 0; |
@@ -841,9 +838,7 @@ bool browse_id3(void) | |||
841 | gui_synclist_init(&id3_lists, &id3_get_info, &info, true, 2, NULL); | 838 | gui_synclist_init(&id3_lists, &id3_get_info, &info, true, 2, NULL); |
842 | gui_synclist_set_nb_items(&id3_lists, info.count*2); | 839 | gui_synclist_set_nb_items(&id3_lists, info.count*2); |
843 | gui_synclist_draw(&id3_lists); | 840 | gui_synclist_draw(&id3_lists); |
844 | gui_syncstatusbar_draw(&statusbars, true); | ||
845 | while (true) { | 841 | while (true) { |
846 | gui_syncstatusbar_draw(&statusbars, false); | ||
847 | key = get_action(CONTEXT_LIST,HZ/2); | 842 | key = get_action(CONTEXT_LIST,HZ/2); |
848 | if(key!=ACTION_NONE && key!=ACTION_UNKNOWN | 843 | if(key!=ACTION_NONE && key!=ACTION_UNKNOWN |
849 | && !gui_synclist_do_button(&id3_lists, &key,LIST_WRAP_UNLESS_HELD)) | 844 | && !gui_synclist_do_button(&id3_lists, &key,LIST_WRAP_UNLESS_HELD)) |
@@ -916,7 +911,6 @@ bool view_runtime(void) | |||
916 | } | 911 | } |
917 | lasttime = current_tick; | 912 | lasttime = current_tick; |
918 | gui_synclist_draw(&lists); | 913 | gui_synclist_draw(&lists); |
919 | gui_syncstatusbar_draw(&statusbars, true); | ||
920 | list_do_action(CONTEXT_STD, HZ, | 914 | list_do_action(CONTEXT_STD, HZ, |
921 | &lists, &action, LIST_WRAP_UNLESS_HELD); | 915 | &lists, &action, LIST_WRAP_UNLESS_HELD); |
922 | if(action == ACTION_STD_CANCEL) | 916 | if(action == ACTION_STD_CANCEL) |
diff --git a/apps/settings.c b/apps/settings.c index b6c721ca32..dcd68b6a9c 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -273,7 +273,7 @@ bool settings_load_config(const char* file, bool apply) | |||
273 | while (read_line(fd, line, sizeof line) > 0) | 273 | while (read_line(fd, line, sizeof line) > 0) |
274 | { | 274 | { |
275 | if (!settings_parseline(line, &name, &value)) | 275 | if (!settings_parseline(line, &name, &value)) |
276 | continue; | 276 | continue; |
277 | for(i=0; i<nb_settings; i++) | 277 | for(i=0; i<nb_settings; i++) |
278 | { | 278 | { |
279 | if (settings[i].cfg_name == NULL) | 279 | if (settings[i].cfg_name == NULL) |
@@ -316,6 +316,8 @@ bool settings_load_config(const char* file, bool apply) | |||
316 | int temp; | 316 | int temp; |
317 | if (cfg_string_to_int(i,&temp,value)) | 317 | if (cfg_string_to_int(i,&temp,value)) |
318 | *(bool*)settings[i].setting = (temp==0?false:true); | 318 | *(bool*)settings[i].setting = (temp==0?false:true); |
319 | if (settings[i].bool_setting->option_callback) | ||
320 | settings[i].bool_setting->option_callback(temp==0?false:true); | ||
319 | break; | 321 | break; |
320 | } | 322 | } |
321 | case F_T_CHARPTR: | 323 | case F_T_CHARPTR: |
diff --git a/apps/settings_list.c b/apps/settings_list.c index e3874566ac..18bcb8ea2c 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #ifdef IPOD_ACCESSORY_PROTOCOL | 52 | #ifdef IPOD_ACCESSORY_PROTOCOL |
53 | #include "iap.h" | 53 | #include "iap.h" |
54 | #endif | 54 | #endif |
55 | #include "statusbar.h" | ||
55 | 56 | ||
56 | #define NVRAM(bytes) (bytes<<F_NVRAM_MASK_SHIFT) | 57 | #define NVRAM(bytes) (bytes<<F_NVRAM_MASK_SHIFT) |
57 | /** NOTE: NVRAM_CONFIG_VERSION is in settings_list.h | 58 | /** NOTE: NVRAM_CONFIG_VERSION is in settings_list.h |
@@ -545,7 +546,7 @@ const struct settings_list settings[] = { | |||
545 | ID2P(LANG_INVERT_CURSOR_BAR)), | 546 | ID2P(LANG_INVERT_CURSOR_BAR)), |
546 | #endif | 547 | #endif |
547 | OFFON_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar, | 548 | OFFON_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar, |
548 | LANG_STATUS_BAR, true,"statusbar", NULL), | 549 | LANG_STATUS_BAR, true,"statusbar", gui_statusbar_changed), |
549 | OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL), | 550 | OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL), |
550 | #if CONFIG_KEYPAD == RECORDER_PAD | 551 | #if CONFIG_KEYPAD == RECORDER_PAD |
551 | OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL), | 552 | OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL), |
diff --git a/apps/tree.c b/apps/tree.c index a3765d74d3..6e05cb5eb0 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -473,7 +473,6 @@ static int update_dir(void) | |||
473 | #endif | 473 | #endif |
474 | gui_synclist_draw(&tree_lists); | 474 | gui_synclist_draw(&tree_lists); |
475 | gui_synclist_speak_item(&tree_lists); | 475 | gui_synclist_speak_item(&tree_lists); |
476 | gui_syncstatusbar_draw(&statusbars, true); | ||
477 | return tc.filesindir; | 476 | return tc.filesindir; |
478 | } | 477 | } |
479 | 478 | ||
@@ -600,7 +599,7 @@ static int dirbrowse() | |||
600 | { | 599 | { |
601 | int numentries=0; | 600 | int numentries=0; |
602 | char buf[MAX_PATH]; | 601 | char buf[MAX_PATH]; |
603 | unsigned button, oldbutton; | 602 | int button, oldbutton; |
604 | bool reload_root = false; | 603 | bool reload_root = false; |
605 | int lastfilter = *tc.dirfilter; | 604 | int lastfilter = *tc.dirfilter; |
606 | bool lastsortcase = global_settings.sort_case; | 605 | bool lastsortcase = global_settings.sort_case; |
@@ -797,10 +796,6 @@ static int dirbrowse() | |||
797 | break; | 796 | break; |
798 | } | 797 | } |
799 | 798 | ||
800 | case ACTION_NONE: | ||
801 | gui_syncstatusbar_draw(&statusbars, false); | ||
802 | break; | ||
803 | |||
804 | #ifdef HAVE_HOTSWAP | 799 | #ifdef HAVE_HOTSWAP |
805 | case SYS_FS_CHANGED: | 800 | case SYS_FS_CHANGED: |
806 | #ifdef HAVE_TAGCACHE | 801 | #ifdef HAVE_TAGCACHE |
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 9dfebf6e38..6c0e2b940f 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -368,7 +368,6 @@ long button_get_w_tmo(int ticks) | |||
368 | ev.id = BUTTON_NONE; | 368 | ev.id = BUTTON_NONE; |
369 | else | 369 | else |
370 | button_data = ev.data; | 370 | button_data = ev.data; |
371 | |||
372 | return ev.id; | 371 | return ev.id; |
373 | } | 372 | } |
374 | 373 | ||
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 29cf8f2eb9..5cebb29847 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h | |||
@@ -80,6 +80,7 @@ | |||
80 | #define SYS_CAR_ADAPTER_RESUME MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 1) | 80 | #define SYS_CAR_ADAPTER_RESUME MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 1) |
81 | #define SYS_IAP_PERIODIC MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 2) | 81 | #define SYS_IAP_PERIODIC MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 2) |
82 | #define SYS_IAP_HANDLEPKT MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 3) | 82 | #define SYS_IAP_HANDLEPKT MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 3) |
83 | #define SYS_FOURHERTZ MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 4) | ||
83 | 84 | ||
84 | #define IS_SYSEVENT(ev) ((ev & SYS_EVENT) == SYS_EVENT) | 85 | #define IS_SYSEVENT(ev) ((ev & SYS_EVENT) == SYS_EVENT) |
85 | 86 | ||