Fixed issue 254: More room for filename in status bar

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1222 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-11-19 01:58:10 +00:00
parent 061bfccae6
commit 73ca64c9dc

View File

@ -735,25 +735,29 @@ void Print_coordinates(void)
void Print_filename(void) void Print_filename(void)
{ {
char display_name[12+1]; word max_size;
int name_size; word string_size;
if (Menu_is_visible) char display_string[256];
// Determine maximum size, in characters
max_size = 12 + (Screen_width / Menu_factor_X - 320) / 8;
string_size = strlen(Main_filename);
// Partial copy of the name
strncpy(display_string, Main_filename, max_size);
display_string[max_size]='\0';
if (string_size > max_size)
{ {
// Si le nom de fichier fait plus de 12 caractères, on n'affiche que les 12 derniers string_size = max_size;
strncpy(display_name,Main_filename,12); display_string[string_size-1]=ELLIPSIS_CHARACTER;
name_size=strlen(Main_filename);
display_name[12]='\0';
if (name_size>12)
{
display_name[11]=ELLIPSIS_CHARACTER;
name_size = 12;
}
Block(Screen_width-96*Menu_factor_X,
Menu_status_Y,Menu_factor_X*96,Menu_factor_Y<<3,MC_Light);
Print_general(Screen_width-name_size*8*Menu_factor_X,Menu_status_Y,display_name,MC_Black,MC_Light);
} }
// Erase whole area
Block(Screen_width-max_size*8*Menu_factor_X,
Menu_status_Y,Menu_factor_X*max_size*8,Menu_factor_Y<<3,MC_Light);
// Print
Print_general(Screen_width-(string_size<<3)*Menu_factor_X,Menu_status_Y,display_string,MC_Black,MC_Light);
} }
// Fonction d'affichage d'une chaine numérique avec une fonte très fine // Fonction d'affichage d'une chaine numérique avec une fonte très fine