diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c index 53af3a2f95..b7b9aa1770 100644 --- a/apps/plugins/disktidy.c +++ b/apps/plugins/disktidy.c @@ -141,7 +141,7 @@ bool tidy_remove_item(char *item, int attr) if (file[rb->strlen(file)-1] == '*') { if (!rb->strncmp(file, item, rb->strlen(file)-1)) - rem = true; + rem = true; } else if (!rb->strcmp(file, item)) rem = true; @@ -192,12 +192,12 @@ enum tidy_return tidy_removedir(const char *name, int *removed) int button; DIR *dir; char fullname[MAX_PATH]; - + /* display status text */ tidy_lcd_status(name, removed); - + rb->yield(); - + dir = rb->opendir(name); if (dir) { @@ -216,12 +216,12 @@ enum tidy_return tidy_removedir(const char *name, int *removed) rb->closedir(dir); return TIDY_RETURN_USB; } - + rb->yield(); - + /* get absolute path */ tidy_get_absolute_path(entry, fullname, name); - + if (entry->attribute & ATTR_DIRECTORY) { /* dir ignore "." and ".." */ @@ -259,12 +259,12 @@ enum tidy_return tidy_clean(const char *name, int *removed) int del; /* has the item been deleted */ DIR *dir; char fullname[MAX_PATH]; - + /* display status text */ tidy_lcd_status(name, removed); - + rb->yield(); - + dir = rb->opendir(name); if (dir) { @@ -283,9 +283,9 @@ enum tidy_return tidy_clean(const char *name, int *removed) rb->closedir(dir); return TIDY_RETURN_USB; } - + rb->yield(); - + if (entry->attribute & ATTR_DIRECTORY) { /* directory ignore "." and ".." */ @@ -293,17 +293,17 @@ enum tidy_return tidy_clean(const char *name, int *removed) (rb->strcmp(entry->d_name, "..") != 0)) { del = 0; - + /* get absolute path */ tidy_get_absolute_path(entry, fullname, name); - + if (tidy_remove_item(entry->d_name, entry->attribute)) { /* delete dir */ tidy_removedir(fullname, removed); del = 1; } - + if (del == 0) { /* dir not deleted so clean it */ @@ -318,11 +318,11 @@ enum tidy_return tidy_clean(const char *name, int *removed) if (tidy_remove_item(entry->d_name, entry->attribute)) { *removed += 1; /* increment removed files counter */ - + /* get absolute path */ char fullname[MAX_PATH]; tidy_get_absolute_path(entry, fullname, name); - + /* delete file */ rb->remove(fullname); del = 1; @@ -338,23 +338,23 @@ enum tidy_return tidy_clean(const char *name, int *removed) } } -enum plugin_status tidy_do(void) +enum tidy_return tidy_do(void) { /* clean disk and display num of items removed */ int removed = 0; enum tidy_return status; char text[24]; /* "Cleaned up nnnnn items" */ - + #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(true); #endif - + status = tidy_clean("/", &removed); - + #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(false); #endif - + if ((status == TIDY_RETURN_OK) || (status == TIDY_RETURN_ABORT)) { rb->lcd_clear_display(); @@ -436,29 +436,32 @@ int list_action_callback(int action, struct gui_synclist *lists) return action; } -int tidy_lcd_menu(void) +enum tidy_return tidy_lcd_menu(void) { - int selection, ret = 3; + int selection = 0; + enum tidy_return status = TIDY_RETURN_OK; bool menu_quit = false; - - MENUITEM_STRINGLIST(menu,"Disktidy Menu",NULL,"Start Cleaning", - "Files to Clean","Quit"); - + + MENUITEM_STRINGLIST(menu, "Disktidy Menu", NULL, + "Start Cleaning", "Files to Clean", + "Quit"); + while (!menu_quit) - { + { switch(rb->do_menu(&menu, &selection, NULL, false)) { - case 0: menu_quit = true; /* start cleaning */ break; - + case 1: { bool show_icons = rb->global_settings->show_icons; struct simplelist_info list; - rb->global_settings->show_icons = true; /* force the icons so its readable */ - rb->simplelist_info_init(&list, "Files to Clean", tidy_type_count, NULL); + /* force the icons so its readable */ + rb->global_settings->show_icons = true; + rb->simplelist_info_init(&list, "Files to Clean", + tidy_type_count, NULL); list.get_icon = get_icon; list.get_name = get_name; list.action_callback = list_action_callback; @@ -466,21 +469,20 @@ int tidy_lcd_menu(void) rb->global_settings->show_icons = show_icons; } break; - + default: - ret = 99; /* exit plugin */ + status = TIDY_RETURN_ABORT; /* exit plugin */ menu_quit = true; break; } } - return ret; + return status; } /* this is the plugin entry point */ enum plugin_status plugin_start(const void* parameter) { enum tidy_return status; - int ret; (void)parameter; tidy_type_count = 0; @@ -491,7 +493,7 @@ enum plugin_status plugin_start(const void* parameter) rb->splash(3*HZ, "Missing disktidy.config file"); return PLUGIN_ERROR; } - ret = tidy_lcd_menu(); + status = tidy_lcd_menu(); if (tidy_loaded_and_changed) { int fd = rb->creat(CUSTOM_FILES); @@ -507,7 +509,7 @@ enum plugin_status plugin_start(const void* parameter) rb->close(fd); } } - if (ret == 99) + if (status == TIDY_RETURN_ABORT) return PLUGIN_OK; while (true) { @@ -520,17 +522,16 @@ enum plugin_status plugin_start(const void* parameter) case TIDY_RETURN_ERROR: return PLUGIN_ERROR; case TIDY_RETURN_USB: - return PLUGIN_USB_CONNECTED; + return PLUGIN_USB_CONNECTED; case TIDY_RETURN_ABORT: - return PLUGIN_OK; + return PLUGIN_OK; } } - + if (rb->default_event_handler(rb->button_get(false)) == SYS_USB_CONNECTED) return PLUGIN_USB_CONNECTED; - + rb->yield(); - return PLUGIN_OK; } diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index 458f6b552a..2a848c2049 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c @@ -312,16 +312,11 @@ static void goto_menu(void); static int load_bitmap( const char *filename ); static int save_bitmap( char *filename ); static void draw_rect_full( int x1, int y1, int x2, int y2 ); -extern int errno; /*********************************************************************** * Global variables ***********************************************************************/ -#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) -int errno; -#endif - static int drawcolor=0; /* Current color (in palette) */ static int bgdrawcolor=9; /* Current background color (in palette) */ bool isbg = false; /* gruik ugly hack alert */ @@ -518,7 +513,8 @@ static void buffer_putsxyofs( fb_data *buf, int buf_width, int buf_height, bits = rb->font_get_bits( pf, ch ); - buffer_mono_bitmap_part( buf, buf_width, buf_height, bits, ofs, 0, width, x, y, width - ofs, pf->height); + buffer_mono_bitmap_part( buf, buf_width, buf_height, bits, ofs, 0, + width, x, y, width - ofs, pf->height); x += width - ofs; ofs = 0; @@ -539,9 +535,9 @@ enum { }; enum { /* Select action menu */ - SELECT_MENU_CUT, SELECT_MENU_COPY, SELECT_MENU_INVERT, - SELECT_MENU_HFLIP, SELECT_MENU_VFLIP, SELECT_MENU_ROTATE90, - SELECT_MENU_ROTATE180, SELECT_MENU_ROTATE270, + SELECT_MENU_CUT, SELECT_MENU_COPY, + SELECT_MENU_INVERT, SELECT_MENU_HFLIP, SELECT_MENU_VFLIP, + SELECT_MENU_ROTATE90, SELECT_MENU_ROTATE180, SELECT_MENU_ROTATE270, SELECT_MENU_CANCEL, }; enum { @@ -562,9 +558,10 @@ MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL, MENUITEM_STRINGLIST(gridsize_menu, "Grid Size", NULL, "No grid", "5px", "10px", "20px"); MENUITEM_STRINGLIST(select_menu, "Select...", NULL, - "Cut", "Copy", "Invert", "Horizontal Flip" , - "Vertical Flip", "Rotate 90°", - "Rotate 180°", "Rotate 270°", "Cancel"); + "Cut", "Copy", + "Invert", "Horizontal Flip", "Vertical Flip", + "Rotate 90°", "Rotate 180°", "Rotate 270°", + "Cancel"); MENUITEM_STRINGLIST(text_menu, "Text", NULL, "Set Text", "Change Font", "Preview", "Apply", "Cancel"); @@ -1574,20 +1571,20 @@ static void draw_line( int x1, int y1, int x2, int y2 ) int deltax = x2 - x1; int deltay = y2 - y1; int i; - + int xerr = abs(deltax); int yerr = abs(deltay); int xstep = deltax > 0 ? 1 : -1; int ystep = deltay > 0 ? 1 : -1; int err; - + if (yerr > xerr) { /* more vertical */ err = yerr; xerr <<= 1; yerr <<= 1; - + /* to leave off the last pixel of the line, leave off the "+ 1" */ for (i = abs(deltay) + 1; i; --i) { @@ -1606,7 +1603,7 @@ static void draw_line( int x1, int y1, int x2, int y2 ) err = xerr; xerr <<= 1; yerr <<= 1; - + for (i = abs(deltax) + 1; i; --i) { draw_pixel(x, y); @@ -1702,7 +1699,7 @@ static void draw_curve( int x1, int y1, int x2, int y2, draw_line( ((xl1>>3)+1)>>1, ((yl1>>3)+1)>>1, ((xr3>>3)+1)>>1, ((yr3>>3)+1)>>1 ); } - } + } #undef PUSH #undef POP } @@ -2090,8 +2087,8 @@ static void linear_gradient( int x1, int y1, int x2, int y2 ) rgb2hsv( r2, g2, b2, &h2, &s2, &v2 ); #define PUSH( x0, y0 ) \ - buffer.coord[i].x = (short)(x0); \ - buffer.coord[i].y = (short)(y0); \ + buffer.coord[i].x = (short)(x0); \ + buffer.coord[i].y = (short)(y0); \ i++; #define POP( a, b ) \ i--; \ @@ -2186,8 +2183,8 @@ static void radial_gradient( int x1, int y1, int x2, int y2 ) rgb2hsv( r2, g2, b2, &h2, &s2, &v2 ); #define PUSH( x0, y0 ) \ - buffer.coord[i].x = (short)(x0); \ - buffer.coord[i].y = (short)(y0); \ + buffer.coord[i].x = (short)(x0); \ + buffer.coord[i].y = (short)(y0); \ i++; #define POP( a, b ) \ i--; \ @@ -2564,7 +2561,9 @@ static bool rockpaint_loop( void ) int button=0,i,j; int accelaration; + x = 10; toolbar(); + x = 0; y = 0; restore_screen(); inv_cursor(true);