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;
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);
}
}

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_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)