Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
diff --git a/apps/bookmark.c b/apps/bookmark.c index 892a3d3..5b92767 100644 @@ -164,6 +164,7 @@ bool bookmark_autobookmark(void) char* bookmark; if (!system_check()) return false; + int i; audio_pause(); /* first pause playback */ bookmark = create_bookmark(); @@ -191,12 +192,9 @@ bool bookmark_autobookmark(void) str(LANG_CONFIRM_WITH_BUTTON)}; const struct text_message message={lines, 2}; #endif -#if LCD_DEPTH > 1 - show_main_backdrop(); /* switch to main backdrop as we may come from wps */ -#endif -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - show_remote_main_backdrop(); -#endif + FOR_NB_SCREENS(i) + screens[i].backdrop_show(BACKDROP_MAIN); + if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) { if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) diff --git a/apps/filetree.c b/apps/filetree.c index e6be09a..6a7da40 100644 @@ -482,7 +482,7 @@ int ft_enter(struct tree_context* c) case FILE_ATTR_WPS: splash(0, ID2P(LANG_WAIT)); #if LCD_DEPTH > 1 - unload_wps_backdrop(); + backdrop_unload(BACKDROP_SKIN_WPS); #endif wps_data_load(SCREEN_MAIN, buf, true); set_file(buf, (char *)global_settings.wps_file, @@ -494,7 +494,7 @@ int ft_enter(struct tree_context* c) case FILE_ATTR_RWPS: splash(0, ID2P(LANG_WAIT)); #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - unload_remote_wps_backdrop(); + remote_backdrop_unload(BACKDROP_SKIN_WPS); #endif wps_data_load(SCREEN_REMOTE, buf, true); set_file(buf, (char *)global_settings.rwps_file, diff --git a/apps/gui/backdrop.c b/apps/gui/backdrop.c index c95fda9..97d101e 100644 #if LCD_DEPTH >= 8 static fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); -static fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); +static fb_data skin_backdrop[LCD_HEIGHT][LCD_WIDTH] __attribute__ ((aligned (16))); #elif LCD_DEPTH == 2 static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH]; -static fb_data wps_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH]; +static fb_data skin_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH]; #endif #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 -static fb_remote_data remote_wps_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]; -static bool remote_wps_backdrop_valid = false; +static fb_remote_data remote_skin_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]; +static bool remote_skin_backdrop_valid = false; #endif static bool main_backdrop_valid = false; -static bool wps_backdrop_valid = false; +static bool skin_backdrop_valid = false; /* load a backdrop into a buffer */ static bool load_backdrop(const char* filename, fb_data* backdrop_buffer) @@ -64,39 +64,39 @@ static bool load_backdrop(const char* filename, fb_data* backdrop_buffer) } } -bool load_main_backdrop(const char* filename) +static bool load_main_backdrop(const char* filename) { main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); return main_backdrop_valid; } -bool load_wps_backdrop(const char* filename) +static inline bool load_skin_backdrop(const char* filename) { - wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]); - return wps_backdrop_valid; + skin_backdrop_valid = load_backdrop(filename, &skin_backdrop[0][0]); + return skin_backdrop_valid; } -void unload_main_backdrop(void) +static inline void unload_main_backdrop(void) { main_backdrop_valid = false; } -void unload_wps_backdrop(void) +static inline void unload_skin_backdrop(void) { - wps_backdrop_valid = false; + skin_backdrop_valid = false; } -void show_main_backdrop(void) +static inline void show_main_backdrop(void) { lcd_set_backdrop(main_backdrop_valid ? &main_backdrop[0][0] : NULL); } -void show_wps_backdrop(void) +static void show_skin_backdrop(void) { /* if no wps backdrop, fall back to main backdrop */ - if(wps_backdrop_valid) + if(skin_backdrop_valid) { - lcd_set_backdrop(&wps_backdrop[0][0]); + lcd_set_backdrop(&skin_backdrop[0][0]); } else { @@ -104,9 +104,39 @@ void show_wps_backdrop(void) } } +/* api functions */ + +bool backdrop_load(enum backdrop_type bdrop, const char* filename) +{ + if (bdrop == BACKDROP_MAIN) + return load_main_backdrop(filename); + else if (bdrop == BACKDROP_SKIN_WPS) + return load_skin_backdrop(filename); + else + return false; +} + +void backdrop_unload(enum backdrop_type bdrop) +{ + if (bdrop == BACKDROP_MAIN) + unload_main_backdrop(); + else if (bdrop == BACKDROP_SKIN_WPS) + unload_skin_backdrop(); +} + +void backdrop_show(enum backdrop_type bdrop) +{ + if (bdrop == BACKDROP_MAIN) + show_main_backdrop(); + else if (bdrop == BACKDROP_SKIN_WPS) + show_skin_backdrop(); +} + + #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 -static bool load_remote_backdrop(const char* filename, fb_remote_data* backdrop_buffer) +static bool load_remote_backdrop(const char* filename, + fb_remote_data* backdrop_buffer) { struct bitmap bm; int ret; @@ -126,23 +156,23 @@ static bool load_remote_backdrop(const char* filename, fb_remote_data* backdrop_ } } -bool load_remote_wps_backdrop(const char* filename) +static inline bool load_remote_skin_backdrop(const char* filename) { - remote_wps_backdrop_valid = load_remote_backdrop(filename, &remote_wps_backdrop[0][0]); - return remote_wps_backdrop_valid; + remote_skin_backdrop_valid = load_remote_backdrop(filename, &remote_skin_backdrop[0][0]); + return remote_skin_backdrop_valid; } -void unload_remote_wps_backdrop(void) +static inline void unload_remote_skin_backdrop(void) { - remote_wps_backdrop_valid = false; + remote_skin_backdrop_valid = false; } -void show_remote_wps_backdrop(void) +static inline void show_remote_skin_backdrop(void) { /* if no wps backdrop, fall back to main backdrop */ - if(remote_wps_backdrop_valid) + if(remote_skin_backdrop_valid) { - lcd_remote_set_backdrop(&remote_wps_backdrop[0][0]); + lcd_remote_set_backdrop(&remote_skin_backdrop[0][0]); } else { @@ -150,8 +180,37 @@ void show_remote_wps_backdrop(void) } } -void show_remote_main_backdrop(void) +static line void show_remote_main_backdrop(void) { lcd_remote_set_backdrop(NULL); } + + +/* api functions */ +bool remote_backdrop_load(enum backdrop_type bdrop, + const char *filename) +{ + if (bdrop == BACKDROP_SKIN_WPS) + return load_remote_skin_backdrop(filename); + else if (bdrop == BACKDROP_MAIN) + return true; + else + return false; +} + +void remote_backrop_show(enum backdrop_type bdrop) +{ + if (bdrop == BACKDROP_MAIN) + show_remote_main_backdrop(); + else if (bdrop == BACKDROP_SKIN_WPS) + show_remote_skin_backdrop(); +} + +void remote_backdrop_unload(enum backdrop_type bdrop) +{ + if (bdrop != BACKDROP_MAIN) + unload_remote_skin_backdrop(); +} + + #endif diff --git a/apps/gui/backdrop.h b/apps/gui/backdrop.h index dc9805f..f3ef1d7 100644 #ifndef _BACKDROP_H #define _BACKDROP_H +enum backdrop_type { + BACKDROP_MAIN, + BACKDROP_SKIN_WPS, +}; + #if LCD_DEPTH > 1 #include "lcd.h" #include "bmp.h" -bool load_main_backdrop(const char* filename); -bool load_wps_backdrop(const char* filename); +bool backdrop_load(enum backdrop_type bdrop, const char*); +void backdrop_unload(enum backdrop_type bdrop); +void backdrop_show(enum backdrop_type bdrop); + +#else /* LCD_DEPTH > 1 */ + +static inline +bool backdrop_load(enum backdrop_type bdrop, const char* filename) +{ + (void)filename; (void)bdrop; return true; +} -void unload_main_backdrop(void); -void unload_wps_backdrop(void); +static inline void backdrop_unload(enum backdrop_type bdrop) +{ + (void)bdrop; +} +static inline void backdrop_show(enum backdrop_type bdrop) +{ + (void)bdrop; +} -void show_main_backdrop(void); -void show_wps_backdrop(void); +#endif + +#if defined(HAVE_REMOTE_LCD) +/* no main backdrop, stubs! */ +#if LCD_REMOTE_DEPTH > 1 +bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename); +void remote_backdropunload(enum backdrop_type bdrop); +void remote_backdrop_show(enum backdrop_type bdrop); +#else +static inline +bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename) +{ + (void)filename; (void)bdrop; return true; +} -#endif /* LCD_DEPTH > 1 */ +static inline void remote_backdrop_unload(enum backdrop_type bdrop) +{ + (void)bdrop; +} -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 -bool load_remote_wps_backdrop(const char* filename); -void unload_remote_wps_backdrop(void); -void show_remote_wps_backdrop(void); -void show_remote_main_backdrop(void); /* only clears the wps backdrop */ +static inline void remote_backdrop_show(enum backdrop_type bdrop) +{ + (void)bdrop; +} +#endif #endif #endif /* _BACKDROP_H */ diff --git a/apps/gui/skin_engine/wps_display.c b/apps/gui/skin_engine/wps_display.c index 9805009..6a94c6a 100644 @@ -82,14 +82,7 @@ bool gui_wps_display(struct gui_wps *gwps) } #endif display->clear_display(); -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - if (display->screen_type == SCREEN_REMOTE) - show_remote_wps_backdrop(); - else if (display->screen_type == SCREEN_MAIN) -#endif -#if LCD_DEPTH > 1 - show_wps_backdrop(); -#endif + display->backdrop_show(BACKDROP_SKIN_WPS); return gui_wps_redraw(gwps, WPS_REFRESH_ALL); } diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c index 1a903c9..c37cd78 100644 @@ -1635,26 +1635,15 @@ static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir) #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) if (bmp_names[BACKDROP_BMP]) { + int screen = SCREEN_MAIN; get_image_filename(bmp_names[BACKDROP_BMP], bmpdir, img_path, sizeof(img_path)); - #if defined(HAVE_REMOTE_LCD) /* We only need to check LCD type if there is a remote LCD */ - if (!wps_data->remote_wps) -#endif - { - /* Load backdrop for the main LCD */ - if (!load_wps_backdrop(img_path)) - return false; - } -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - else - { - /* Load backdrop for the remote LCD */ - if (!load_remote_wps_backdrop(img_path)) - return false; - } + if (wps_data->remote_wps) + screen = SCREEN_REMOTE; #endif + screens[screen].backdrop_load(BACKDROP_SKIN_WPS, img_path); } #endif /* has backdrop support */ diff --git a/apps/gui/wps.c b/apps/gui/wps.c index bce4db2..19e4247 100644 @@ -115,24 +115,9 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile) "%pb\n", #endif }; + screens[screen].backdrop_unload(BACKDROP_SKIN_WPS); skin_data_load(gui_wps[screen].data, &screens[screen], skin_buf[screen], false); - /* set the default wps for the main-screen */ - if(screen == SCREEN_MAIN) - { -#if LCD_DEPTH > 1 - unload_wps_backdrop(); -#endif - } -#ifdef HAVE_REMOTE_LCD - /* set the default wps for the remote-screen */ - else if(screen == SCREEN_REMOTE) - { -#if LCD_REMOTE_DEPTH > 1 - unload_remote_wps_backdrop(); -#endif - } -#endif } #ifdef HAVE_REMOVE_LCD gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN); @@ -564,16 +549,13 @@ static void gwps_leave_wps(void) int i, oldbars = VP_SB_HIDE_ALL; FOR_NB_SCREENS(i) + { gui_wps[i].display->stop_scroll(); + gui_wps[i].display->backdrop_show(BACKDROP_MAIN); + } if (global_settings.statusbar) oldbars = VP_SB_ALLSCREENS; -#if LCD_DEPTH > 1 - show_main_backdrop(); -#endif -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - show_remote_main_backdrop(); -#endif viewportmanager_set_statusbar(oldbars); #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) /* Play safe and unregister the hook */ @@ -1237,23 +1219,18 @@ void gui_sync_wps_init(void) wps_datas[i].wps_uses_albumart = 0; #endif #ifdef HAVE_REMOTE_LCD - wps_datas[i].remote_wps = (i != 0); + wps_datas[i].remote_wps = (i == SCREEN_REMOTE); #endif gui_wps[i].data = &wps_datas[i]; gui_wps[i].display = &screens[i]; /* Currently no seperate wps_state needed/possible so use the only available ( "global" ) one */ gui_wps[i].state = &wps_state; + gui_wps[i].display->backdrop_unload(BACKDROP_SKIN_WPS); } #ifdef HAVE_LCD_BITMAP add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler); #endif -#if LCD_DEPTH > 1 - unload_wps_backdrop(); -#endif -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - unload_remote_wps_backdrop(); -#endif } #ifdef HAVE_ALBUMART diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index 25b1824..f96a6ce 100644 static int clear_main_backdrop(void) { global_settings.backdrop_file[0]=0; - unload_main_backdrop(); - show_main_backdrop(); + backdrop_unload(BACKDROP_MAIN); + backdrop_show(BACKDROP_MAIN); settings_save(); return 0; } diff --git a/apps/onplay.c b/apps/onplay.c index ad71f73..3052f8d 100644 @@ -560,11 +560,11 @@ static bool delete_dir(void) static bool set_backdrop(void) { /* load the image */ - if(load_main_backdrop(selected_file)) { + if(backdrop_load(BACKDROP_MAIN, selected_file)) { splash(HZ, str(LANG_BACKDROP_LOADED)); set_file(selected_file, (char *)global_settings.backdrop_file, MAX_FILENAME); - show_main_backdrop(); + backdrop_show(BACKDROP_MAIN); return true; } else { splash(HZ, str(LANG_BACKDROP_FAILED)); diff --git a/apps/screen_access.c b/apps/screen_access.c index 2f928b7..d0b483f 100644 #include <icons.h> #include "screen_access.h" +#include "backdrop.h" /* some helper functions to calculate metrics on the fly */ static int screen_helper_getcharwidth(void) @@ -197,8 +198,11 @@ struct screen screens[NB_SCREENS] = .backlight_off=&backlight_off, .is_backlight_on=&is_backlight_on, .backlight_set_timeout=&backlight_set_timeout, + .backdrop_load=&backdrop_load, + .backdrop_unload=&backdrop_unload, + .backdrop_show=&backdrop_show, #ifdef HAVE_BUTTONBAR - .has_buttonbar=false + .has_buttonbar=false, #endif }, #if NB_SCREENS == 2 @@ -278,7 +282,10 @@ struct screen screens[NB_SCREENS] = .backlight_on=&remote_backlight_on, .backlight_off=&remote_backlight_off, .is_backlight_on=&is_remote_backlight_on, - .backlight_set_timeout=&remote_backlight_set_timeout + .backlight_set_timeout=&remote_backlight_set_timeout, + .backdrop_load=&remote_backdrop_load, + .backdrop_unload=&remote_backdrop_unload, + .backdrop_show=&remote_backdrop_show, } #endif /* HAVE_REMOTE_LCD */ }; diff --git a/apps/screen_access.h b/apps/screen_access.h index c76d2b1..f0fed01 100644 #include "lcd.h" #include "buttonbar.h" +#include "backdrop.h" enum screen_type { SCREEN_MAIN @@ -152,6 +153,9 @@ struct screen void (*backlight_off)(void); bool (*is_backlight_on)(bool ignore_always_off); void (*backlight_set_timeout)(int index); + bool (*backdrop_load)(enum backdrop_type bdrop, const char* filename); + void (*backdrop_unload)(enum backdrop_type bdrop); + void (*backdrop_show)(enum backdrop_type bdrop); }; #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) diff --git a/apps/screens.c b/apps/screens.c index 9a98671..9f1596c 100644 @@ -183,14 +183,9 @@ void usb_screen(void) int i; bool statusbar = global_settings.statusbar; /* force the statusbar */ global_settings.statusbar = true; -#if LCD_DEPTH > 1 - show_main_backdrop(); -#endif -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - show_remote_main_backdrop(); -#endif FOR_NB_SCREENS(i) { + screens[i].backdrop_show(BACKDROP_MAIN); screens[i].backlight_on(); screens[i].clear_display(); #if NB_SCREENS > 1 diff --git a/apps/settings.c b/apps/settings.c index 423e6ed..7c99272 100644 @@ -730,6 +730,7 @@ void settings_apply(bool read_disk) #if CONFIG_CODEC == SWCODEC int i; #endif + int screen; sound_settings_apply(); @@ -838,12 +839,9 @@ void settings_apply(bool read_disk) else load_kbd(NULL); #endif -#if LCD_DEPTH > 1 - unload_wps_backdrop(); -#endif -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - unload_remote_wps_backdrop(); -#endif + FOR_NB_SCREENS(screen) + backdrop_unload(BACKDROP_SKIN_WPS); + if ( global_settings.wps_file[0] && global_settings.wps_file[0] != 0xff ) { snprintf(buf, sizeof buf, WPS_DIR "/%s.wps", @@ -861,16 +859,15 @@ void settings_apply(bool read_disk) global_settings.backdrop_file[0] != 0xff ) { snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", global_settings.backdrop_file); - load_main_backdrop(buf); + backdrop_load(BACKDROP_MAIN, buf); } else { - unload_main_backdrop(); + backdrop_unload(BACKDROP_MAIN); } - show_main_backdrop(); -#endif -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - show_remote_main_backdrop(); #endif + FOR_NB_SCREENS(screen) + backdrop_show(BACKDROP_MAIN); + #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) if ( global_settings.rwps_file[0]) { snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps", |