From 1f134eabf3e6b69c91860b9597292bef9d5034ea Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Sun, 20 Jan 2013 12:42:14 +0000 Subject: [PATCH] Show extension in menu select file if too long name --- src/computer.c | 127 ++++++++++++++++++++++++------------------------- src/menu_sdl.c | 16 +++---- 2 files changed, 69 insertions(+), 74 deletions(-) diff --git a/src/computer.c b/src/computer.c index 5a939db..0c8af8b 100644 --- a/src/computer.c +++ b/src/computer.c @@ -935,47 +935,45 @@ inline void paint_pixels (unsigned char octet,unsigned char ink, unsigned char p mask = 0x80; - for (bucle = 0; bucle < 8; bucle++) { - + for (bucle = 0; bucle < 8; bucle++) + { if (draw) { - valor = (octet & mask) ? (int) ink : (int) paper; - p=(colors+valor); + valor = (octet & mask) ? (int) ink : (int) paper; + p=(colors+valor); - paint_one_pixel((unsigned char *)p,ordenador.pixel); + paint_one_pixel((unsigned char *)p,ordenador.pixel); - switch (ordenador.npixels) - { - case 2: - ordenador.pixel+=ordenador.next_pixel; - paint_one_pixel((unsigned char *)p,ordenador.pixel); - break; - case 4: - paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); - ordenador.pixel+=ordenador.next_pixel; - paint_one_pixel((unsigned char *)p,ordenador.pixel); - paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); - break; - default: - break; - } + switch (ordenador.npixels) + { + case 2: + ordenador.pixel+=ordenador.next_pixel; + paint_one_pixel((unsigned char *)p,ordenador.pixel); + break; + case 4: + paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); + ordenador.pixel+=ordenador.next_pixel; + paint_one_pixel((unsigned char *)p,ordenador.pixel); + paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); + break; + default: + break; + } } else { - - switch (ordenador.npixels) - { - case 2: - ordenador.pixel+=ordenador.next_pixel; - break; - case 4: - ordenador.pixel+=ordenador.next_pixel; - break; - default: - break; + switch (ordenador.npixels) + { + case 2: + ordenador.pixel+=ordenador.next_pixel; + break; + case 4: + ordenador.pixel+=ordenador.next_pixel; + break; + default: + break; + } } - } - ordenador.pixel+=ordenador.next_pixel; mask = ((mask >> 1) & 0x7F); } @@ -989,47 +987,46 @@ inline void paint_pixels_precision (unsigned char octet,unsigned char ink, unsig if (ordenador.pixels_octect==0) mask = 0x80; - for (bucle = 0; bucle < 2; bucle++) { + for (bucle = 0; bucle < 2; bucle++) + { if (draw) { - valor = (octet & mask) ? (int) ink : (int) paper; - p=(colors+valor); + valor = (octet & mask) ? (int) ink : (int) paper; + p=(colors+valor); - paint_one_pixel((unsigned char *)p,ordenador.pixel); + paint_one_pixel((unsigned char *)p,ordenador.pixel); - switch (ordenador.npixels) - { - case 2: - ordenador.pixel+=ordenador.next_pixel; - paint_one_pixel((unsigned char *)p,ordenador.pixel); - break; - case 4: - paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); - ordenador.pixel+=ordenador.next_pixel; - paint_one_pixel((unsigned char *)p,ordenador.pixel); - paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); - break; - default: - break; - } + switch (ordenador.npixels) + { + case 2: + ordenador.pixel+=ordenador.next_pixel; + paint_one_pixel((unsigned char *)p,ordenador.pixel); + break; + case 4: + paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); + ordenador.pixel+=ordenador.next_pixel; + paint_one_pixel((unsigned char *)p,ordenador.pixel); + paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); + break; + default: + break; + } } else { - switch (ordenador.npixels) - { - case 2: - ordenador.pixel+=ordenador.next_pixel; - break; - case 4: - ordenador.pixel+=ordenador.next_pixel; - break; - default: - break; + switch (ordenador.npixels) + { + case 2: + ordenador.pixel+=ordenador.next_pixel; + break; + case 4: + ordenador.pixel+=ordenador.next_pixel; + break; + default: + break; + } } - } - ordenador.pixel+=ordenador.next_pixel; - mask = ((mask >> 1) & 0x7F); } } diff --git a/src/menu_sdl.c b/src/menu_sdl.c index 7eac9de..2164904 100644 --- a/src/menu_sdl.c +++ b/src/menu_sdl.c @@ -425,19 +425,17 @@ void menu_print_font(SDL_Surface *screen, int r, int g, int b, SDL_Rect dst = {x, y, 0, 0}; SDL_Color color = {r, g, b}; char buf[255]; - unsigned int i; + unsigned int i, lenght; memset(buf, 0, sizeof(buf)); strncpy(buf, msg, 254); if (buf[0] != '|' && buf[0] != '^' && buf[0] != '.' && buf[0] != '-' && buf[0] != ' ' && !strstr(buf, " \"")) { - if (strlen(buf)>max_string) + lenght = strlen(buf); + if (lenght>max_string) { - //buf[_MAX_STRING-3] = '.'; - //buf[_MAX_STRING-2] = '.'; - //buf[_MAX_STRING-1] = '.'; - buf[max_string] = '\0'; + strcpy (buf + max_string-4, buf + lenght-4); } } /* Fixup multi-menu option look */ @@ -781,7 +779,7 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel, int font_siz ptr = strrchr (name, '.'); if (ptr) *ptr = 0; - //Always load from SD card + //Always load from Default device strcpy(filename,getenv("HOME")); length=strlen(filename); if ((length>0)&&(filename[length-1]!='/')) @@ -1094,9 +1092,9 @@ static int menu_select_internal(SDL_Surface *screen, else if (keys & KEY_DOWN) select_next(p_menu, 0, 1, 1); else if (keys & KEY_PAGEUP) - select_next(p_menu, 0, -18, 0); + select_next(p_menu, 0, -19, 0); else if (keys & KEY_PAGEDOWN) - select_next(p_menu, 0, 18, 0); + select_next(p_menu, 0, 19, 0); else if (keys & KEY_LEFT) select_next(p_menu, -1, 0 ,1); else if (keys & KEY_RIGHT)