diff options
-rw-r--r-- | apps/plugins/pictureflow.c | 197 |
1 files changed, 139 insertions, 58 deletions
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index db5b6fbfb4..6d29cb1e12 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -68,7 +68,7 @@ typedef unsigned char pix_t; | |||
68 | typedef fb_data pix_t; | 68 | typedef fb_data pix_t; |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | #define WRNDUP(w, size) (((w)+(size)-1)/(size)*(size)) | 71 | #define WRNDUP(w, size) (((w)+(size)-1) & (~(size - 1))) |
72 | #ifdef HAVE_SCROLLWHEEL | 72 | #ifdef HAVE_SCROLLWHEEL |
73 | #define PICTUREFLOW_NEXT_ALBUM PLA_DOWN | 73 | #define PICTUREFLOW_NEXT_ALBUM PLA_DOWN |
74 | #define PICTUREFLOW_NEXT_ALBUM_REPEAT PLA_DOWN_REPEAT | 74 | #define PICTUREFLOW_NEXT_ALBUM_REPEAT PLA_DOWN_REPEAT |
@@ -187,7 +187,8 @@ const struct picture logos[]={ | |||
187 | {pictureflow_logo, BMPWIDTH_pictureflow_logo, BMPHEIGHT_pictureflow_logo}, | 187 | {pictureflow_logo, BMPWIDTH_pictureflow_logo, BMPHEIGHT_pictureflow_logo}, |
188 | }; | 188 | }; |
189 | 189 | ||
190 | enum show_album_name_values { album_name_hide = 0, album_name_bottom , album_name_top }; | 190 | enum show_album_name_values { album_name_hide = 0, album_name_bottom , |
191 | album_name_top }; | ||
191 | 192 | ||
192 | struct config_data { | 193 | struct config_data { |
193 | long avg_album_width; | 194 | long avg_album_width; |
@@ -222,7 +223,8 @@ static int slide_cache_in_use; | |||
222 | 223 | ||
223 | /* use long for aligning */ | 224 | /* use long for aligning */ |
224 | unsigned long thread_stack[THREAD_STACK_SIZE / sizeof(long)]; | 225 | unsigned long thread_stack[THREAD_STACK_SIZE / sizeof(long)]; |
225 | static int slide_cache_stack[SLIDE_CACHE_SIZE]; /* queue (as array) for scheduling load_surface */ | 226 | /* queue (as array) for scheduling load_surface */ |
227 | static int slide_cache_stack[SLIDE_CACHE_SIZE]; | ||
226 | static int slide_cache_stack_index; | 228 | static int slide_cache_stack_index; |
227 | struct mutex slide_cache_stack_lock; | 229 | struct mutex slide_cache_stack_lock; |
228 | 230 | ||
@@ -244,6 +246,7 @@ static int track_count; | |||
244 | static int track_index; | 246 | static int track_index; |
245 | static int selected_track; | 247 | static int selected_track; |
246 | static int selected_track_pulse; | 248 | static int selected_track_pulse; |
249 | void reset_track_list(void); | ||
247 | 250 | ||
248 | #define INPUT_SIZE BM_SIZE(DISPLAY_SIZE, DISPLAY_SIZE, FORMAT_NATIVE, 0) | 251 | #define INPUT_SIZE BM_SIZE(DISPLAY_SIZE, DISPLAY_SIZE, FORMAT_NATIVE, 0) |
249 | #define SC_BUF_SIZE BM_SCALED_SIZE(DISPLAY_SIZE, 0, FORMAT_NATIVE, 0) | 252 | #define SC_BUF_SIZE BM_SCALED_SIZE(DISPLAY_SIZE, 0, FORMAT_NATIVE, 0) |
@@ -266,6 +269,8 @@ static int prev_center_index = -1; | |||
266 | 269 | ||
267 | static int start_index_track_list = 0; | 270 | static int start_index_track_list = 0; |
268 | static int track_list_visible_entries = 0; | 271 | static int track_list_visible_entries = 0; |
272 | static int track_list_y; | ||
273 | static int track_list_h; | ||
269 | static int track_scroll_index = 0; | 274 | static int track_scroll_index = 0; |
270 | static int track_scroll_dir = 1; | 275 | static int track_scroll_dir = 1; |
271 | 276 | ||
@@ -390,7 +395,8 @@ int create_album_index(void) | |||
390 | if ( album_count > 0 ) | 395 | if ( album_count > 0 ) |
391 | album[album_count].name_idx = album[album_count-1].name_idx + old_l; | 396 | album[album_count].name_idx = album[album_count-1].name_idx + old_l; |
392 | 397 | ||
393 | if ( (album[album_count].name_idx + l) > MAX_ALBUMS*AVG_ALBUM_NAME_LENGTH ) | 398 | if ( (album[album_count].name_idx + l) > |
399 | MAX_ALBUMS*AVG_ALBUM_NAME_LENGTH ) | ||
394 | /* not enough memory */ | 400 | /* not enough memory */ |
395 | return ERROR_BUFFER_FULL; | 401 | return ERROR_BUFFER_FULL; |
396 | 402 | ||
@@ -451,8 +457,8 @@ int create_track_index(const int slide_index) | |||
451 | track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1; | 457 | track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1; |
452 | if (track_num >= 0) | 458 | if (track_num >= 0) |
453 | { | 459 | { |
454 | rb->snprintf(temp_titles[track_num],sizeof(temp_titles[track_num]), "%d: %s", | 460 | rb->snprintf(temp_titles[track_num],sizeof(temp_titles[track_num]), |
455 | track_num+1, tcs.result); | 461 | "%d: %s", track_num+1, tcs.result); |
456 | temp_seeks[track_num] = tcs.result_seek; | 462 | temp_seeks[track_num] = tcs.result_seek; |
457 | } | 463 | } |
458 | else | 464 | else |
@@ -500,7 +506,8 @@ int create_track_index(const int slide_index) | |||
500 | The algorithm looks for the first track of the given album uses | 506 | The algorithm looks for the first track of the given album uses |
501 | find_albumart to find the filename. | 507 | find_albumart to find the filename. |
502 | */ | 508 | */ |
503 | bool get_albumart_for_index_from_db(const int slide_index, char *buf, int buflen) | 509 | bool get_albumart_for_index_from_db(const int slide_index, char *buf, |
510 | int buflen) | ||
504 | { | 511 | { |
505 | if ( slide_index == -1 ) | 512 | if ( slide_index == -1 ) |
506 | { | 513 | { |
@@ -595,9 +602,13 @@ bool create_albumart_cache(bool force) | |||
595 | config.avg_album_width = 0; | 602 | config.avg_album_width = 0; |
596 | char pfraw_file[MAX_PATH]; | 603 | char pfraw_file[MAX_PATH]; |
597 | char albumart_file[MAX_PATH]; | 604 | char albumart_file[MAX_PATH]; |
605 | unsigned int format = FORMAT_NATIVE; | ||
606 | if (config.resize) | ||
607 | format |= FORMAT_RESIZE|FORMAT_KEEP_ASPECT; | ||
598 | for (i=0; i < album_count; i++) | 608 | for (i=0; i < album_count; i++) |
599 | { | 609 | { |
600 | rb->snprintf(pfraw_file, sizeof(pfraw_file), CACHE_PREFIX "/%d.pfraw", i); | 610 | rb->snprintf(pfraw_file, sizeof(pfraw_file), CACHE_PREFIX "/%d.pfraw", |
611 | i); | ||
601 | /* delete existing cache, so it's a true rebuild */ | 612 | /* delete existing cache, so it's a true rebuild */ |
602 | if(rb->file_exists(pfraw_file)) | 613 | if(rb->file_exists(pfraw_file)) |
603 | rb->remove(pfraw_file); | 614 | rb->remove(pfraw_file); |
@@ -609,9 +620,7 @@ bool create_albumart_cache(bool force) | |||
609 | input_bmp.width = DISPLAY_SIZE; | 620 | input_bmp.width = DISPLAY_SIZE; |
610 | input_bmp.height = DISPLAY_SIZE; | 621 | input_bmp.height = DISPLAY_SIZE; |
611 | ret = rb->read_bmp_file(albumart_file, &input_bmp, | 622 | ret = rb->read_bmp_file(albumart_file, &input_bmp, |
612 | plugin_buf_size, | 623 | plugin_buf_size, format, FPLUGIN); |
613 | FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, | ||
614 | FPLUGIN); | ||
615 | if (ret <= 0) { | 624 | if (ret <= 0) { |
616 | rb->splash(HZ, "Could not read bmp"); | 625 | rb->splash(HZ, "Could not read bmp"); |
617 | continue; /* skip missing/broken files */ | 626 | continue; /* skip missing/broken files */ |
@@ -684,25 +693,36 @@ void slide_stack_push(const int slide_index) | |||
684 | if ( tmp == center_index ) { | 693 | if ( tmp == center_index ) { |
685 | /* the center_index is on top of the stack so do not touch that */ | 694 | /* the center_index is on top of the stack so do not touch that */ |
686 | if ( slide_cache_stack_index > 0 ) { | 695 | if ( slide_cache_stack_index > 0 ) { |
687 | /* but maybe it is possible to swap the given slide_index to the second place */ | 696 | /* |
688 | tmp = slide_cache_stack[ slide_cache_stack_index -1 ]; | 697 | but maybe it is possible to swap the given slide_index to |
689 | slide_cache_stack[ slide_cache_stack_index - 1 ] = slide_cache_stack[ i ]; | 698 | the second place |
690 | slide_cache_stack[ i ] = tmp; | 699 | */ |
700 | tmp = slide_cache_stack[slide_cache_stack_index - 1]; | ||
701 | slide_cache_stack[slide_cache_stack_index - 1] = | ||
702 | slide_cache_stack[i]; | ||
703 | slide_cache_stack[i] = tmp; | ||
691 | } | 704 | } |
692 | } | 705 | } |
693 | else { | 706 | else { |
694 | /* if the center_index is not on top (i.e. already loaded) bring the slide_index to the top */ | 707 | /* |
695 | slide_cache_stack[ slide_cache_stack_index ] = slide_cache_stack[ i ]; | 708 | if the center_index is not on top (i.e. already loaded) bring |
696 | slide_cache_stack[ i ] = tmp; | 709 | the slide_index to the top |
710 | */ | ||
711 | slide_cache_stack[slide_cache_stack_index] = slide_cache_stack[i]; | ||
712 | slide_cache_stack[i] = tmp; | ||
697 | } | 713 | } |
698 | } | 714 | } |
699 | else { | 715 | else { |
700 | /* slide_index is not on the stack */ | 716 | /* slide_index is not on the stack */ |
701 | if ( slide_cache_stack_index >= SLIDE_CACHE_SIZE-1 ) { | 717 | if ( slide_cache_stack_index >= SLIDE_CACHE_SIZE-1 ) { |
702 | /* if we exceeded the stack size, clear the first half of the stack */ | 718 | /* |
719 | if we exceeded the stack size, clear the first half of the | ||
720 | stack | ||
721 | */ | ||
703 | slide_cache_stack_index = SLIDE_CACHE_SIZE/2; | 722 | slide_cache_stack_index = SLIDE_CACHE_SIZE/2; |
704 | for (i = 0; i <= slide_cache_stack_index ; i++) | 723 | for (i = 0; i <= slide_cache_stack_index ; i++) |
705 | slide_cache_stack[ i ] = slide_cache_stack[ i + slide_cache_stack_index ]; | 724 | slide_cache_stack[i] = slide_cache_stack[i + |
725 | slide_cache_stack_index]; | ||
706 | } | 726 | } |
707 | if ( slide_cache_stack[ slide_cache_stack_index ] == center_index ) { | 727 | if ( slide_cache_stack[ slide_cache_stack_index ] == center_index ) { |
708 | /* if the center_index is on top leave it there */ | 728 | /* if the center_index is on top leave it there */ |
@@ -796,7 +816,8 @@ void end_pf_thread(void) | |||
796 | */ | 816 | */ |
797 | bool create_pf_thread(void) | 817 | bool create_pf_thread(void) |
798 | { | 818 | { |
799 | rb->queue_init(&thread_q, true); /* put the thread's queue in the bcast list */ | 819 | /* put the thread's queue in the bcast list */ |
820 | rb->queue_init(&thread_q, true); | ||
800 | if ((thread_id = rb->create_thread( | 821 | if ((thread_id = rb->create_thread( |
801 | thread, | 822 | thread, |
802 | thread_stack, | 823 | thread_stack, |
@@ -1013,7 +1034,8 @@ static inline struct bitmap *surface(const int slide_index) | |||
1013 | return 0; | 1034 | return 0; |
1014 | 1035 | ||
1015 | int i; | 1036 | int i; |
1016 | for (i = 0; i < slide_cache_in_use; i++) { /* maybe do the inverse mapping => implies dynamic allocation? */ | 1037 | for (i = 0; i < slide_cache_in_use; i++) { |
1038 | /* maybe do the inverse mapping => implies dynamic allocation? */ | ||
1017 | if ( cache[i].index == slide_index ) { | 1039 | if ( cache[i].index == slide_index ) { |
1018 | /* We have already loaded our slide, so touch it and return it. */ | 1040 | /* We have already loaded our slide, so touch it and return it. */ |
1019 | cache[i].touched = *rb->current_tick; | 1041 | cache[i].touched = *rb->current_tick; |
@@ -1073,10 +1095,8 @@ void recalc_table(void) | |||
1073 | 1095 | ||
1074 | itilt = 70 * IANGLE_MAX / 360; /* approx. 70 degrees tilted */ | 1096 | itilt = 70 * IANGLE_MAX / 360; /* approx. 70 degrees tilted */ |
1075 | 1097 | ||
1076 | offsetX = config.avg_album_width / 2 * (PFREAL_ONE - fcos(itilt)); | 1098 | offsetX = DISPLAY_SIZE / 2 * (fsin(itilt) + PFREAL_ONE); |
1077 | offsetY = config.avg_album_width / 2 * fsin(itilt); | 1099 | offsetY = DISPLAY_SIZE / 2 * (fsin(itilt) + PFREAL_ONE / 2); |
1078 | offsetX += config.avg_album_width * PFREAL_ONE * 3 / 4; | ||
1079 | offsetY += config.avg_album_width * PFREAL_ONE / 4; | ||
1080 | offsetX += config.extra_spacing_for_center_slide << PFREAL_SHIFT; | 1100 | offsetX += config.extra_spacing_for_center_slide << PFREAL_SHIFT; |
1081 | } | 1101 | } |
1082 | 1102 | ||
@@ -1546,22 +1566,39 @@ int create_empty_slide(bool force) | |||
1546 | return true; | 1566 | return true; |
1547 | } | 1567 | } |
1548 | 1568 | ||
1569 | /** | ||
1570 | Shows the album name setting menu | ||
1571 | */ | ||
1572 | int album_name_menu(void) | ||
1573 | { | ||
1574 | int selection = config.show_album_name; | ||
1575 | |||
1576 | MENUITEM_STRINGLIST(album_name_menu,"Show album title",NULL, | ||
1577 | "Hide album title", "Show at the bottom", "Show at the top"); | ||
1578 | rb->do_menu(&album_name_menu, &selection, NULL, false); | ||
1579 | |||
1580 | config.show_album_name = selection; | ||
1581 | return GO_TO_PREVIOUS; | ||
1582 | } | ||
1549 | 1583 | ||
1550 | /** | 1584 | /** |
1551 | Shows the settings menu | 1585 | Shows the settings menu |
1552 | */ | 1586 | */ |
1553 | int settings_menu(void) { | 1587 | int settings_menu(void) |
1588 | { | ||
1554 | int selection = 0; | 1589 | int selection = 0; |
1590 | bool old_val; | ||
1555 | 1591 | ||
1556 | MENUITEM_STRINGLIST(settings_menu, "PictureFlow Settings", NULL, "Show FPS", | 1592 | MENUITEM_STRINGLIST(settings_menu, "PictureFlow Settings", NULL, "Show FPS", |
1557 | "Spacing", "Center margin", "Number of slides", "Zoom", | 1593 | "Spacing", "Center margin", "Number of slides", "Zoom", |
1558 | "Rebuild cache"); | 1594 | "Show album title", "Resize Covers", "Rebuild cache"); |
1559 | 1595 | ||
1560 | do { | 1596 | do { |
1561 | selection=rb->do_menu(&settings_menu,&selection, NULL, false); | 1597 | selection=rb->do_menu(&settings_menu,&selection, NULL, false); |
1562 | switch(selection) { | 1598 | switch(selection) { |
1563 | case 0: | 1599 | case 0: |
1564 | rb->set_bool("Show FPS", &(config.show_fps)); | 1600 | rb->set_bool("Show FPS", &(config.show_fps)); |
1601 | reset_track_list(); | ||
1565 | break; | 1602 | break; |
1566 | 1603 | ||
1567 | case 1: | 1604 | case 1: |
@@ -1575,7 +1612,7 @@ int settings_menu(void) { | |||
1575 | case 2: | 1612 | case 2: |
1576 | rb->set_int("Center margin", "", 1, | 1613 | rb->set_int("Center margin", "", 1, |
1577 | &(config.extra_spacing_for_center_slide), | 1614 | &(config.extra_spacing_for_center_slide), |
1578 | NULL, 1, -50, 50, NULL ); | 1615 | NULL, 1, -70, 70, NULL ); |
1579 | recalc_table(); | 1616 | recalc_table(); |
1580 | reset_slides(); | 1617 | reset_slides(); |
1581 | break; | 1618 | break; |
@@ -1594,6 +1631,18 @@ int settings_menu(void) { | |||
1594 | reset_slides(); | 1631 | reset_slides(); |
1595 | break; | 1632 | break; |
1596 | case 5: | 1633 | case 5: |
1634 | album_name_menu(); | ||
1635 | reset_track_list(); | ||
1636 | recalc_table(); | ||
1637 | reset_slides(); | ||
1638 | break; | ||
1639 | case 6: | ||
1640 | old_val = config.resize; | ||
1641 | rb->set_bool("Resize Covers", &(config.resize)); | ||
1642 | if (old_val == config.resize) /* changed? */ | ||
1643 | break; | ||
1644 | /* fallthrough if changed, since cache needs to be rebuilt */ | ||
1645 | case 7: | ||
1597 | rb->remove(CACHE_PREFIX "/ready"); | 1646 | rb->remove(CACHE_PREFIX "/ready"); |
1598 | rb->remove(EMPTY_SLIDE); | 1647 | rb->remove(EMPTY_SLIDE); |
1599 | rb->splash(HZ, "Cache will be rebuilt on next restart"); | 1648 | rb->splash(HZ, "Cache will be rebuilt on next restart"); |
@@ -1645,14 +1694,14 @@ int main_menu(void) | |||
1645 | */ | 1694 | */ |
1646 | void set_default_config(void) | 1695 | void set_default_config(void) |
1647 | { | 1696 | { |
1648 | config.spacing_between_slides = 40; | 1697 | config.spacing_between_slides = (LCD_WIDTH - DISPLAY_SIZE) / 8; |
1649 | config.extra_spacing_for_center_slide = 0; | 1698 | config.extra_spacing_for_center_slide = (LCD_WIDTH - DISPLAY_SIZE) / 16; |
1650 | config.show_slides = 3; | 1699 | config.show_slides = 4; |
1651 | config.avg_album_width = 0; | 1700 | config.avg_album_width = 0; |
1652 | config.zoom = 100; | 1701 | config.zoom = 100; |
1653 | config.show_fps = false; | 1702 | config.show_fps = false; |
1654 | config.resize = true; | 1703 | config.resize = true; |
1655 | config.show_album_name = album_name_bottom; | 1704 | config.show_album_name = album_name_top; |
1656 | } | 1705 | } |
1657 | 1706 | ||
1658 | /** | 1707 | /** |
@@ -1751,21 +1800,46 @@ static inline void draw_gradient(int y, int h) | |||
1751 | } | 1800 | } |
1752 | 1801 | ||
1753 | 1802 | ||
1803 | static void track_list_yh(int char_height) | ||
1804 | { | ||
1805 | switch (config.show_album_name) | ||
1806 | { | ||
1807 | case album_name_hide: | ||
1808 | track_list_y = (config.show_fps ? char_height : 0); | ||
1809 | track_list_h = LCD_HEIGHT - track_list_y; | ||
1810 | break; | ||
1811 | case album_name_bottom: | ||
1812 | track_list_y = (config.show_fps ? char_height : 0); | ||
1813 | track_list_h = LCD_HEIGHT - track_list_y - char_height * 2; | ||
1814 | break; | ||
1815 | default: /* case album_name_top */ | ||
1816 | track_list_y = char_height * 2; | ||
1817 | track_list_h = LCD_HEIGHT - track_list_y - | ||
1818 | (config.show_fps ? char_height : 0); | ||
1819 | break; | ||
1820 | } | ||
1821 | } | ||
1822 | |||
1754 | /** | 1823 | /** |
1755 | Reset the track list after a album change | 1824 | Reset the track list after a album change |
1756 | */ | 1825 | */ |
1757 | void reset_track_list(void) | 1826 | void reset_track_list(void) |
1758 | { | 1827 | { |
1759 | int albumtxt_w, albumtxt_h; | 1828 | int albumtxt_h = rb->screens[SCREEN_MAIN]->getcharheight(); |
1760 | const char* albumtxt = get_album_name(center_index); | 1829 | track_list_yh(albumtxt_h); |
1761 | MYLCD(getstringsize)(albumtxt, &albumtxt_w, &albumtxt_h); | 1830 | track_list_visible_entries = fmin( track_list_h/albumtxt_h , track_count ); |
1762 | const int height = | ||
1763 | LCD_HEIGHT-albumtxt_h-10 - (config.show_fps?(albumtxt_h + 5):0); | ||
1764 | track_list_visible_entries = fmin( height/albumtxt_h , track_count ); | ||
1765 | start_index_track_list = 0; | 1831 | start_index_track_list = 0; |
1766 | track_scroll_index = 0; | 1832 | track_scroll_index = 0; |
1767 | track_scroll_dir = 1; | 1833 | track_scroll_dir = 1; |
1768 | selected_track = 0; | 1834 | selected_track = 0; |
1835 | |||
1836 | /* let the tracklist start more centered | ||
1837 | * if the screen isn't filled with tracks */ | ||
1838 | if (track_count*albumtxt_h < track_list_h) | ||
1839 | { | ||
1840 | track_list_h = track_count * albumtxt_h; | ||
1841 | track_list_y = LCD_HEIGHT / 2 - (track_list_h / 2); | ||
1842 | } | ||
1769 | } | 1843 | } |
1770 | 1844 | ||
1771 | /** | 1845 | /** |
@@ -1778,23 +1852,15 @@ void show_track_list(void) | |||
1778 | create_track_index(center_slide.slide_index); | 1852 | create_track_index(center_slide.slide_index); |
1779 | reset_track_list(); | 1853 | reset_track_list(); |
1780 | } | 1854 | } |
1781 | static int titletxt_w, titletxt_h, titletxt_y, titletxt_x, i, color; | 1855 | static int titletxt_w, titletxt_x, color, titletxt_h; |
1782 | MYLCD(getstringsize)("W", NULL, &titletxt_h); | 1856 | titletxt_h = rb->screens[SCREEN_MAIN]->getcharheight(); |
1783 | if (track_list_visible_entries >= track_count) | ||
1784 | { | ||
1785 | int albumtxt_h; | ||
1786 | const char* albumtxt = get_album_name(center_index); | ||
1787 | MYLCD(getstringsize)(albumtxt, NULL, &albumtxt_h); | ||
1788 | titletxt_y = ((LCD_HEIGHT-albumtxt_h-10)-(track_count*albumtxt_h))/2; | ||
1789 | } | ||
1790 | else if (config.show_fps) | ||
1791 | titletxt_y = titletxt_h + 5; | ||
1792 | else | ||
1793 | titletxt_y = 0; | ||
1794 | 1857 | ||
1858 | int titletxt_y = track_list_y; | ||
1795 | int track_i; | 1859 | int track_i; |
1796 | for (i=0; i < track_list_visible_entries; i++) { | 1860 | track_i = start_index_track_list; |
1797 | track_i = i+start_index_track_list; | 1861 | for (;track_i < track_list_visible_entries+start_index_track_list; |
1862 | track_i++) | ||
1863 | { | ||
1798 | MYLCD(getstringsize)(get_track_name(track_i), &titletxt_w, NULL); | 1864 | MYLCD(getstringsize)(get_track_name(track_i), &titletxt_w, NULL); |
1799 | titletxt_x = (LCD_WIDTH-titletxt_w)/2; | 1865 | titletxt_x = (LCD_WIDTH-titletxt_w)/2; |
1800 | if ( track_i == selected_track ) { | 1866 | if ( track_i == selected_track ) { |
@@ -1844,6 +1910,9 @@ void select_prev_track(void) | |||
1844 | */ | 1910 | */ |
1845 | void draw_album_text(void) | 1911 | void draw_album_text(void) |
1846 | { | 1912 | { |
1913 | if (0 == config.show_album_name) | ||
1914 | return; | ||
1915 | |||
1847 | int albumtxt_w, albumtxt_h; | 1916 | int albumtxt_w, albumtxt_h; |
1848 | int albumtxt_y = 0; | 1917 | int albumtxt_y = 0; |
1849 | 1918 | ||
@@ -1874,7 +1943,11 @@ void draw_album_text(void) | |||
1874 | albumtxt_dir = -1; | 1943 | albumtxt_dir = -1; |
1875 | prev_center_index = center_index; | 1944 | prev_center_index = center_index; |
1876 | } | 1945 | } |
1877 | albumtxt_y = LCD_HEIGHT-albumtxt_h-10; | 1946 | |
1947 | if (config.show_album_name == album_name_top) | ||
1948 | albumtxt_y = albumtxt_h / 2; | ||
1949 | else | ||
1950 | albumtxt_y = LCD_HEIGHT - albumtxt_h - albumtxt_h/2; | ||
1878 | 1951 | ||
1879 | if (albumtxt_w > LCD_WIDTH ) { | 1952 | if (albumtxt_w > LCD_WIDTH ) { |
1880 | MYLCD(putsxy)(albumtxt_x, albumtxt_y , albumtxt); | 1953 | MYLCD(putsxy)(albumtxt_x, albumtxt_y , albumtxt); |
@@ -1976,6 +2049,7 @@ int main(void) | |||
1976 | long current_update; | 2049 | long current_update; |
1977 | long update_interval = 100; | 2050 | long update_interval = 100; |
1978 | int fps = 0; | 2051 | int fps = 0; |
2052 | int fpstxt_y; | ||
1979 | 2053 | ||
1980 | bool instant_update; | 2054 | bool instant_update; |
1981 | old_drawmode = rb->lcd_get_drawmode(); | 2055 | old_drawmode = rb->lcd_get_drawmode(); |
@@ -2022,14 +2096,20 @@ int main(void) | |||
2022 | frames = 0; | 2096 | frames = 0; |
2023 | } | 2097 | } |
2024 | /* Draw FPS */ | 2098 | /* Draw FPS */ |
2025 | if (config.show_fps) { | 2099 | if (config.show_fps) |
2100 | { | ||
2026 | #ifdef USEGSLIB | 2101 | #ifdef USEGSLIB |
2027 | MYLCD(set_foreground)(G_BRIGHT(255)); | 2102 | MYLCD(set_foreground)(G_BRIGHT(255)); |
2028 | #else | 2103 | #else |
2029 | MYLCD(set_foreground)(G_PIX(255,0,0)); | 2104 | MYLCD(set_foreground)(G_PIX(255,0,0)); |
2030 | #endif | 2105 | #endif |
2031 | rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps); | 2106 | rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps); |
2032 | MYLCD(putsxy)(0, 0, fpstxt); | 2107 | if (config.show_album_name == album_name_top) |
2108 | fpstxt_y = LCD_HEIGHT - | ||
2109 | rb->screens[SCREEN_MAIN]->getcharheight(); | ||
2110 | else | ||
2111 | fpstxt_y = 0; | ||
2112 | MYLCD(putsxy)(0, fpstxt_y, fpstxt); | ||
2033 | } | 2113 | } |
2034 | draw_album_text(); | 2114 | draw_album_text(); |
2035 | 2115 | ||
@@ -2119,7 +2199,8 @@ int main(void) | |||
2119 | 2199 | ||
2120 | /*************************** Plugin entry point ****************************/ | 2200 | /*************************** Plugin entry point ****************************/ |
2121 | 2201 | ||
2122 | enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter) | 2202 | enum plugin_status plugin_start(const struct plugin_api *api, |
2203 | const void *parameter) | ||
2123 | { | 2204 | { |
2124 | int ret; | 2205 | int ret; |
2125 | 2206 | ||