a bit of code polish for rockpaint and disktidy.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22187 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2009-08-06 12:44:12 +00:00
parent c3aec89bec
commit c4dc61a2a6
2 changed files with 65 additions and 65 deletions

View file

@ -338,7 +338,7 @@ 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;
@ -436,19 +436,20 @@ 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;
@ -457,8 +458,10 @@ int tidy_lcd_menu(void)
{
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;
@ -468,19 +471,18 @@ int tidy_lcd_menu(void)
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)
{
@ -531,6 +533,5 @@ enum plugin_status plugin_start(const void* parameter)
rb->yield();
return PLUGIN_OK;
}

View file

@ -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");
@ -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);