Index: apps/plugins/pictureflow.c =================================================================== --- apps/plugins/pictureflow.c (Revision 15954) +++ apps/plugins/pictureflow.c (Arbeitskopie) @@ -175,14 +175,20 @@ {pictureflow_logo, BMPWIDTH_pictureflow_logo, BMPHEIGHT_pictureflow_logo}, }; +enum show_album_name_values { album_name_hide = 0, album_name_bottom , album_name_top }; + struct config_data { long avg_album_width; int spacing_between_slides; int extra_spacing_for_center_slide; int show_slides; int zoom; + enum show_album_name_values show_album_name; }; +const int track_list_offset = ((LCD_HEIGHT > 100) ? 30 : 20); /* make the moving of the tracklist due to the album name moving more usable on small LCDs */ + + /** below we allocate the memory we want to use **/ static fb_data *buffer; /* for now it always points to the lcd framebuffer */ @@ -1529,22 +1535,39 @@ return true; } +/** + Shows the album name setting menu +*/ +int album_name_menu(void) { + void reset_track_list(void); + int selection = config.show_album_name; + MENUITEM_STRINGLIST(album_name_menu,"Show album title",NULL, + "Hide album title", "Show at the bottom", "Show at the top"); + rb->do_menu(&album_name_menu,&selection); + config.show_album_name = selection; + reset_track_list(); + return GO_TO_PREVIOUS; +} + + /** Shows the settings menu */ int settings_menu(void) { int selection = 0; + void reset_track_list(void); MENUITEM_STRINGLIST(settings_menu, "PictureFlow Settings", NULL, "Show FPS", "Spacing", "Center margin", "Number of slides", "Zoom", - "Rebuild cache"); + "Show album titles", "Rebuild cache"); do { selection=rb->do_menu(&settings_menu,&selection); switch(selection) { case 0: rb->set_bool("Show FPS", &show_fps); + reset_track_list(); break; case 1: @@ -1571,13 +1594,17 @@ break; case 4: - rb->set_int("Number of slides", "", 1, &(config.zoom), + rb->set_int("Zoom", "", 1, &(config.zoom), NULL, 1, 10, 300, NULL ); recalc_table(); reset_slides(); break; - case 5: + album_name_menu(); + recalc_table(); + reset_slides(); + break; + case 6: rb->remove(CACHE_PREFIX "/ready"); rb->remove(EMPTY_SLIDE); rb->splash(HZ, "Cache will be rebuilt on next restart"); @@ -1635,6 +1662,7 @@ config.show_slides = 3; config.avg_album_width = 0; config.zoom = 100; + config.show_album_name = album_name_bottom; } /** @@ -1743,7 +1771,17 @@ const char* albumtxt = get_album_name(center_index); rb->lcd_getstringsize(albumtxt, &albumtxt_w, &albumtxt_h); const int height = LCD_HEIGHT-albumtxt_h-10; - track_list_visible_entries = fmin( height/albumtxt_h , track_count ); + switch (config.show_album_name) { + case album_name_hide: + track_list_visible_entries = fmin((LCD_HEIGHT-(show_fps ? + track_list_offset : 0))/albumtxt_h, track_count); + break; + case album_name_bottom: + case album_name_top: + track_list_visible_entries = fmin((height-(show_fps ? + track_list_offset : 0))/albumtxt_h, track_count); + break; + } start_index_track_list = 0; track_scroll_index = 0; track_scroll_dir = 1; @@ -1761,7 +1799,10 @@ reset_track_list(); } static int titletxt_w, titletxt_h, titletxt_y, titletxt_x, i, color; - titletxt_y = 0; + /* adjust track list a bit downwards whem album title is set to be shown at the top + OR fps show fps is enabled */ + titletxt_y = ((config.show_album_name == album_name_top || show_fps) ? + track_list_offset : 0); int track_i; for (i=0; i < track_list_visible_entries; i++) { track_i = i+start_index_track_list; @@ -1844,8 +1885,8 @@ albumtxt_dir = -1; prev_center_index = center_index; } - albumtxt_y = LCD_HEIGHT-albumtxt_h-10; - + albumtxt_y = ((config.show_album_name == album_name_bottom) ? + (LCD_HEIGHT-albumtxt_h-10) : 10); if (albumtxt_w > LCD_WIDTH ) { rb->lcd_putsxy(albumtxt_x, albumtxt_y , albumtxt); if ( pf_state == pf_idle || pf_state == pf_show_tracks ) { @@ -1945,6 +1986,7 @@ reset_slides(); char fpstxt[10]; + int fpstxt_w, fpstxt_h; int button; #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -1991,6 +2033,7 @@ break; } + rb->lcd_getstringsize(fpstxt, &fpstxt_w, &fpstxt_h); /* Calculate FPS */ if (current_update - last_update > update_interval) { fps = frames * HZ / (current_update - last_update); @@ -2002,10 +2045,14 @@ if (show_fps) { rb->lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps); - rb->lcd_putsxy(0, 0, fpstxt); + /* move fps text to the bottom, when the album + titles are set to be shown at the top */ + rb->lcd_putsxy(0, (config.show_album_name == album_name_top ? + (LCD_HEIGHT-fpstxt_h) : 0), fpstxt); } - draw_album_text(); + if (config.show_album_name) /* Don't draw when album names are hidden */ + draw_album_text(); /* Copy offscreen buffer to LCD and give time to other threads */