Index: apps/plugins/jpeg/jpeg.c =================================================================== --- apps/plugins/jpeg/jpeg.c (revision 20324) +++ apps/plugins/jpeg/jpeg.c (working copy) @@ -176,7 +176,7 @@ /* the current full file name */ static char np_file[MAX_PATH]; -static int curfile = 0, direction = DIR_NONE, entries = 0; +static int curfile = 0, direction = DIR_NONE, entries = 0, delcount = 0; /* list of the jpeg files */ static char **file_pt; @@ -233,9 +233,12 @@ pname++; /* Find Selected File. */ - for(i = 0; i < entries; i++) - if(!rb->strcmp(file_pt[i], pname)) + for(i = 0; i < entries; i++){ + delcount++; + if(!rb->strcmp(file_pt[i], pname)){ curfile = i; + } + } } int change_filename(int direct) @@ -357,6 +360,7 @@ MIID_QUIT = 0, MIID_TOGGLE_SS_MODE, MIID_CHANGE_SS_MODE, + MIID_DELETE, #if PLUGIN_BUFFER_SIZE >= MIN_MEM MIID_SHOW_PLAYBACK_MENU, #endif @@ -373,6 +377,8 @@ { "Toggle Slideshow Mode", NULL }, [MIID_CHANGE_SS_MODE] = { "Change Slideshow Time", NULL }, + [MIID_DELETE]= + { "Delete Current File", NULL }, #if PLUGIN_BUFFER_SIZE >= MIN_MEM [MIID_SHOW_PLAYBACK_MENU] = { "Show Playback Menu", NULL }, @@ -400,6 +406,9 @@ menu_exit(m); return 1; break; + case MIID_DELETE: + return 2; + break; case MIID_TOGGLE_SS_MODE: rb->set_option("Toggle Slideshow", &slideshow_enabled, INT, slideshow , 2, NULL); @@ -604,10 +613,11 @@ } /* interactively scroll around the image */ -int scroll_bmp(struct t_disp* pdisp) +int scroll_bmp(struct t_disp* pdisp, char *filename) { int button; int lastbutton = 0; + int menu_return = 0; while (true) { @@ -696,9 +706,45 @@ #ifdef USEGSLIB grey_show(false); /* switch off greyscale overlay */ #endif - if (show_menu() == 1) - return PLUGIN_OK; - + menu_return = show_menu(); + if (menu_return == 1) + { + return PLUGIN_OK; + } + if (menu_return == 2) + { + rb->lcd_clear_display(); + rb->lcd_puts(0,1,"Delete?"); + rb->lcd_puts_scroll(0,2,(char*)filename); + rb->lcd_puts(0,4,">> = Yes"); + rb->lcd_puts(0,5,"Any other = No"); + rb->lcd_update(); + button = rb->button_get(true); + switch(button) + { + case JPEG_RIGHT: + rb->lcd_clear_display(); + rb->lcd_puts(0,1,"Deleted"); + rb->lcd_puts_scroll(0,2,(char*)filename); + rb->remove(filename); + rb->button_clear_queue(); + delcount--; + if (delcount < 1){ + rb->splash(HZ, "No More Files."); + return 1; + break; + }else{ + file_pt[curfile] = '\0'; + return change_filename(DIR_NEXT); + break; + } + default: + rb->button_clear_queue(); + return change_filename(DIR_PREV); + break; + } + break; + } #ifdef USEGSLIB grey_show(true); /* switch on greyscale overlay */ #else @@ -940,7 +986,12 @@ { rb->snprintf(print,sizeof(print),"err opening %s:%d",filename,fd); rb->splash(HZ, print); - return PLUGIN_ERROR; + if (entries < 0){ + rb->splash(HZ, "No Files."); + return PLUGIN_ERROR; + }else{ + return change_filename(DIR_PREV); + } } filesize = rb->filesize(fd); rb->memset(&disp, 0, sizeof(disp)); @@ -1135,7 +1186,7 @@ */ while (1) { - status = scroll_bmp(p_disp); + status = scroll_bmp(p_disp, filename); if (status == ZOOM_IN) { if (ds > ds_min) @@ -1260,5 +1311,6 @@ grey_release(); /* deinitialize */ #endif + rb->set_current_file(np_file); return condition; } Index: apps/bitmaps/native/rockboxlogo.176x54x16.bmp =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream