-Pad font names with spaces, as we need that to clear the dropdown button from previus selection

-Made the font dropdown a little larger to hold 'fairlight' (quite a big group ;))
-Don't list fonts in the skin fileselector


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@888 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-06-28 19:27:20 +00:00
parent a619897862
commit cc64de7e1f

View File

@ -950,7 +950,8 @@ void Button_Settings(void)
Close_window(); Close_window();
Unselect_button(BUTTON_SETTINGS); Unselect_button(BUTTON_SETTINGS);
// Raffichage du menu pour que les inscriptions qui y figurent soient retracées avec la nouvelle fonte // Raffichage du menu pour que les inscriptions qui y figurent soient
// retracées avec la nouvelle fonte
Display_menu(); Display_menu();
Display_cursor(); Display_cursor();
@ -961,6 +962,14 @@ void Button_Settings(void)
// Data for skin selector // Data for skin selector
T_Fileselector Skin_files_list; T_Fileselector Skin_files_list;
/// Checks if the filename is a skin or a font. We avoid adding fonts to the
/// skin selector, and vice versa
char is_font(const char* name)
{
return name[0]=='f' && name[1]=='o' && name[2]=='n' && name[3]=='t'
&& name[4]=='_';
}
// Add a skin to the list // Add a skin to the list
void Add_skin(const char *name) void Add_skin(const char *name)
{ {
@ -974,7 +983,9 @@ void Add_skin(const char *name)
else else
fname=name; fname=name;
namelength = strlen(fname); namelength = strlen(fname);
if (namelength>=5 && fname[0]!='_' && (!strcasecmp(fname+namelength-4,".png") || !strcasecmp(fname+namelength-4,".gif"))) if (namelength>=5 && fname[0]!='_' && !is_font(fname)
&& (!strcasecmp(fname+namelength-4,".png")
|| !strcasecmp(fname+namelength-4,".gif")))
{ {
Add_element_to_list(&Skin_files_list, name, 0); Add_element_to_list(&Skin_files_list, name, 0);
@ -983,7 +994,9 @@ void Add_skin(const char *name)
strcpy(Skin_files_list.First->Full_name, fname); strcpy(Skin_files_list.First->Full_name, fname);
// Reformat the short name differently // Reformat the short name differently
strcpy(Skin_files_list.First->Short_name,Format_filename(Skin_files_list.First->Full_name, 0)); strcpy(Skin_files_list.First->Short_name,
Format_filename(Skin_files_list.First->Full_name, 0)
);
} }
} }
@ -1020,7 +1033,7 @@ void Button_Skins(void)
T_Scroller_button * file_scroller; T_Scroller_button * file_scroller;
int selected_font=0; int selected_font=0;
char * fonts[] = {"Classic", "Fun", "Melon", "Fairlight"}; char * fonts[] = {"Classic ", "Fun ", "Melon ", "Fairlight"};
int nb_fonts = 4; int nb_fonts = 4;
#define FILESEL_Y 52 #define FILESEL_Y 52
@ -1057,11 +1070,13 @@ void Button_Skins(void)
// Fileselector // Fileselector
Window_set_special_button(8,FILESEL_Y+1,144,80), // 2 Window_set_special_button(8,FILESEL_Y+1,144,80), // 2
// Scroller du fileselector // Scroller du fileselector
(file_scroller = Window_set_scroller_button(160,FILESEL_Y+1,82,Skin_files_list.Nb_elements,10,selector_position)), // 3 (file_scroller = Window_set_scroller_button(160,FILESEL_Y+1,82,
Skin_files_list.Nb_elements,10,selector_position)), // 3
Draw_one_skin_name); // 4 Draw_one_skin_name); // 4
// Boutons de fontes // Font dropdown
font_dropdown = Window_set_dropdown_button(60,19,70,11,0, fonts[selected_font],1,0,1,RIGHT_SIDE|LEFT_SIDE); // 5 font_dropdown = Window_set_dropdown_button(60,19,86,11,0,
fonts[selected_font],1,0,1,RIGHT_SIDE|LEFT_SIDE); // 5
for (temp=0; temp<nb_fonts; temp++) for (temp=0; temp<nb_fonts; temp++)
Window_dropdown_add_item(font_dropdown,temp,fonts[temp]); Window_dropdown_add_item(font_dropdown,temp,fonts[temp]);