Show extension in menu select file if too long name

This commit is contained in:
fabio.olimpieri 2013-01-20 12:42:14 +00:00
parent ddcbe793d8
commit 1f134eabf3
2 changed files with 69 additions and 74 deletions

View File

@ -935,47 +935,45 @@ inline void paint_pixels (unsigned char octet,unsigned char ink, unsigned char p
mask = 0x80; mask = 0x80;
for (bucle = 0; bucle < 8; bucle++) { for (bucle = 0; bucle < 8; bucle++)
{
if (draw) if (draw)
{ {
valor = (octet & mask) ? (int) ink : (int) paper; valor = (octet & mask) ? (int) ink : (int) paper;
p=(colors+valor); p=(colors+valor);
paint_one_pixel((unsigned char *)p,ordenador.pixel); paint_one_pixel((unsigned char *)p,ordenador.pixel);
switch (ordenador.npixels) switch (ordenador.npixels)
{ {
case 2: case 2:
ordenador.pixel+=ordenador.next_pixel; ordenador.pixel+=ordenador.next_pixel;
paint_one_pixel((unsigned char *)p,ordenador.pixel); paint_one_pixel((unsigned char *)p,ordenador.pixel);
break; break;
case 4: case 4:
paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline);
ordenador.pixel+=ordenador.next_pixel; ordenador.pixel+=ordenador.next_pixel;
paint_one_pixel((unsigned char *)p,ordenador.pixel); paint_one_pixel((unsigned char *)p,ordenador.pixel);
paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline);
break; break;
default: default:
break; break;
} }
} }
else else
{ {
switch (ordenador.npixels)
switch (ordenador.npixels) {
{ case 2:
case 2: ordenador.pixel+=ordenador.next_pixel;
ordenador.pixel+=ordenador.next_pixel; break;
break; case 4:
case 4: ordenador.pixel+=ordenador.next_pixel;
ordenador.pixel+=ordenador.next_pixel; break;
break; default:
default: break;
break; }
} }
}
ordenador.pixel+=ordenador.next_pixel; ordenador.pixel+=ordenador.next_pixel;
mask = ((mask >> 1) & 0x7F); 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; if (ordenador.pixels_octect==0) mask = 0x80;
for (bucle = 0; bucle < 2; bucle++) { for (bucle = 0; bucle < 2; bucle++)
{
if (draw) if (draw)
{ {
valor = (octet & mask) ? (int) ink : (int) paper; valor = (octet & mask) ? (int) ink : (int) paper;
p=(colors+valor); p=(colors+valor);
paint_one_pixel((unsigned char *)p,ordenador.pixel); paint_one_pixel((unsigned char *)p,ordenador.pixel);
switch (ordenador.npixels) switch (ordenador.npixels)
{ {
case 2: case 2:
ordenador.pixel+=ordenador.next_pixel; ordenador.pixel+=ordenador.next_pixel;
paint_one_pixel((unsigned char *)p,ordenador.pixel); paint_one_pixel((unsigned char *)p,ordenador.pixel);
break; break;
case 4: case 4:
paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline);
ordenador.pixel+=ordenador.next_pixel; ordenador.pixel+=ordenador.next_pixel;
paint_one_pixel((unsigned char *)p,ordenador.pixel); paint_one_pixel((unsigned char *)p,ordenador.pixel);
paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline); paint_one_pixel((unsigned char *)p,ordenador.pixel+ordenador.next_scanline);
break; break;
default: default:
break; break;
} }
} }
else else
{ {
switch (ordenador.npixels) switch (ordenador.npixels)
{ {
case 2: case 2:
ordenador.pixel+=ordenador.next_pixel; ordenador.pixel+=ordenador.next_pixel;
break; break;
case 4: case 4:
ordenador.pixel+=ordenador.next_pixel; ordenador.pixel+=ordenador.next_pixel;
break; break;
default: default:
break; break;
}
} }
}
ordenador.pixel+=ordenador.next_pixel; ordenador.pixel+=ordenador.next_pixel;
mask = ((mask >> 1) & 0x7F); mask = ((mask >> 1) & 0x7F);
} }
} }

View File

@ -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_Rect dst = {x, y, 0, 0};
SDL_Color color = {r, g, b}; SDL_Color color = {r, g, b};
char buf[255]; char buf[255];
unsigned int i; unsigned int i, lenght;
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
strncpy(buf, msg, 254); strncpy(buf, msg, 254);
if (buf[0] != '|' && buf[0] != '^' && buf[0] != '.' if (buf[0] != '|' && buf[0] != '^' && buf[0] != '.'
&& buf[0] != '-' && buf[0] != ' ' && !strstr(buf, " \"")) && buf[0] != '-' && buf[0] != ' ' && !strstr(buf, " \""))
{ {
if (strlen(buf)>max_string) lenght = strlen(buf);
if (lenght>max_string)
{ {
//buf[_MAX_STRING-3] = '.'; strcpy (buf + max_string-4, buf + lenght-4);
//buf[_MAX_STRING-2] = '.';
//buf[_MAX_STRING-1] = '.';
buf[max_string] = '\0';
} }
} }
/* Fixup multi-menu option look */ /* 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, '.'); ptr = strrchr (name, '.');
if (ptr) *ptr = 0; if (ptr) *ptr = 0;
//Always load from SD card //Always load from Default device
strcpy(filename,getenv("HOME")); strcpy(filename,getenv("HOME"));
length=strlen(filename); length=strlen(filename);
if ((length>0)&&(filename[length-1]!='/')) if ((length>0)&&(filename[length-1]!='/'))
@ -1094,9 +1092,9 @@ static int menu_select_internal(SDL_Surface *screen,
else if (keys & KEY_DOWN) else if (keys & KEY_DOWN)
select_next(p_menu, 0, 1, 1); select_next(p_menu, 0, 1, 1);
else if (keys & KEY_PAGEUP) else if (keys & KEY_PAGEUP)
select_next(p_menu, 0, -18, 0); select_next(p_menu, 0, -19, 0);
else if (keys & KEY_PAGEDOWN) else if (keys & KEY_PAGEDOWN)
select_next(p_menu, 0, 18, 0); select_next(p_menu, 0, 19, 0);
else if (keys & KEY_LEFT) else if (keys & KEY_LEFT)
select_next(p_menu, -1, 0 ,1); select_next(p_menu, -1, 0 ,1);
else if (keys & KEY_RIGHT) else if (keys & KEY_RIGHT)