More work on fonts/skins
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@890 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									48c98b2234
								
							
						
					
					
						commit
						d4dcba62a6
					
				
							
								
								
									
										14
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Makefile
									
									
									
									
									
								
							@ -227,6 +227,8 @@ endif
 | 
				
			|||||||
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
 | 
					# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
 | 
				
			||||||
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o  $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o 
 | 
					OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o  $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SKIN_FILES = skins/skin_classic.png skins/skin_modern.png skins/font_Classic.png skins/font_Fun.png
 | 
				
			||||||
 | 
					
 | 
				
			||||||
all : $(BIN)
 | 
					all : $(BIN)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
debug : $(BIN)
 | 
					debug : $(BIN)
 | 
				
			||||||
@ -240,9 +242,9 @@ ziprelease: version $(BIN) release
 | 
				
			|||||||
	echo `sed "s/.*=\"\(.*\)\";/\1/" pversion.c`.`svnversion` | tr " :" "_-" | sed -e s/\\(wip\\)\\\\./\\1/I > $(OBJDIR)/versiontag
 | 
						echo `sed "s/.*=\"\(.*\)\";/\1/" pversion.c`.`svnversion` | tr " :" "_-" | sed -e s/\\(wip\\)\\\\./\\1/I > $(OBJDIR)/versiontag
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tar cvzf "src-`cat $(OBJDIR)/versiontag`.tgz" --transform 's,^,src/,g' *.c *.h Makefile Makefile.dep gfx2.ico 
 | 
						tar cvzf "src-`cat $(OBJDIR)/versiontag`.tgz" --transform 's,^,src/,g' *.c *.h Makefile Makefile.dep gfx2.ico 
 | 
				
			||||||
	$(ZIP) $(ZIPOPT) "grafx2-`cat $(OBJDIR)/versiontag`$(TTFLABEL)-$(PLATFORM).$(ZIP)" $(BIN) gfx2def.ini skins/modern.png skins/classic.png gfx2.gif doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-`cat $(OBJDIR)/versiontag`.tgz $(PLATFORMFILES)
 | 
						$(ZIP) $(ZIPOPT) "grafx2-`cat $(OBJDIR)/versiontag`$(TTFLABEL)-$(PLATFORM).$(ZIP)" $(BIN) gfx2def.ini $(SKIN_FILES) gfx2.gif doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-`cat $(OBJDIR)/versiontag`.tgz $(PLATFORMFILES)
 | 
				
			||||||
	$(DELCOMMAND) "src-`cat $(OBJDIR)/versiontag`.tgz"
 | 
						$(DELCOMMAND) "src-`cat $(OBJDIR)/versiontag`.tgz"
 | 
				
			||||||
	tar cvzf "grafx2-`cat $(OBJDIR)/versiontag`$(TTFLABEL)-src.tgz" --transform 's,^,grafx2/,g' *.c *.h Makefile Makefile.dep gfx2def.ini skins/modern.png skins/classic.png gfx2.ico gfx2.gif doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt misc/grafx2.1 misc/grafx2.xpm misc/grafx2.desktop fonts/8pxfont.png fonts/Tuffy.ttf
 | 
						tar cvzf "grafx2-`cat $(OBJDIR)/versiontag`$(TTFLABEL)-src.tgz" --transform 's,^,grafx2/,g' *.c *.h Makefile Makefile.dep gfx2def.ini $(SKIN_FILES) gfx2.ico gfx2.gif doc/README.txt doc/COMPILING.txt doc/gpl-2.0.txt misc/grafx2.1 misc/grafx2.xpm misc/grafx2.desktop fonts/8pxfont.png fonts/Tuffy.ttf
 | 
				
			||||||
	$(DELCOMMAND) "$(OBJDIR)/versiontag"
 | 
						$(DELCOMMAND) "$(OBJDIR)/versiontag"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
testsed :
 | 
					testsed :
 | 
				
			||||||
@ -303,8 +305,7 @@ install : $(BIN)
 | 
				
			|||||||
	$(CP) gfx2def.ini $(DESTDIR)$(datadir)/grafx2/
 | 
						$(CP) gfx2def.ini $(DESTDIR)$(datadir)/grafx2/
 | 
				
			||||||
	$(CP) gfx2.gif $(DESTDIR)$(datadir)/grafx2/
 | 
						$(CP) gfx2.gif $(DESTDIR)$(datadir)/grafx2/
 | 
				
			||||||
	$(CP) fonts/* $(DESTDIR)$(datadir)/grafx2/fonts/
 | 
						$(CP) fonts/* $(DESTDIR)$(datadir)/grafx2/fonts/
 | 
				
			||||||
	$(CP) skins/modern.png $(DESTDIR)$(datadir)/grafx2/skins/
 | 
						$(CP) $(SKIN_FILES) $(DESTDIR)$(datadir)/grafx2/skins/
 | 
				
			||||||
	$(CP) skins/classic.png $(DESTDIR)$(datadir)/grafx2/skins/
 | 
					 | 
				
			||||||
	# Icon and desktop file for debian
 | 
						# Icon and desktop file for debian
 | 
				
			||||||
	$(CP) misc/grafx2.desktop $(DESTDIR)$(datadir)/applications/
 | 
						$(CP) misc/grafx2.desktop $(DESTDIR)$(datadir)/applications/
 | 
				
			||||||
	$(CP) misc/grafx2.xpm $(DESTDIR)$(datadir)/icons/
 | 
						$(CP) misc/grafx2.xpm $(DESTDIR)$(datadir)/icons/
 | 
				
			||||||
@ -318,8 +319,9 @@ uninstall :
 | 
				
			|||||||
	$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/gfx2.gif
 | 
						$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/gfx2.gif
 | 
				
			||||||
	$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/fonts/*
 | 
						$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/fonts/*
 | 
				
			||||||
	$(if $(wildcard $(DESTDIR)$(datadir)/grafx2/fonts),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/fonts)
 | 
						$(if $(wildcard $(DESTDIR)$(datadir)/grafx2/fonts),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/fonts)
 | 
				
			||||||
	$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/skins/modern.png
 | 
						cd $(DESTDIR)$(datadir)/grafx2
 | 
				
			||||||
	$(DELCOMMAND) $(DESTDIR)$(datadir)/grafx2/skins/classic.png
 | 
						$(DELCOMMAND) $(SKIN_FILES)
 | 
				
			||||||
 | 
						cd ..
 | 
				
			||||||
	$(if $(wildcard $(DESTDIR)$(datadir)/grafx2/skins),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/skins)
 | 
						$(if $(wildcard $(DESTDIR)$(datadir)/grafx2/skins),,$(RMDIR) $(DESTDIR)$(datadir)/grafx2/skins)
 | 
				
			||||||
	# Icon and desktop file for debian
 | 
						# Icon and desktop file for debian
 | 
				
			||||||
	$(DELCOMMAND) $(DESTDIR)$(datadir)/applications/grafx2.desktop
 | 
						$(DELCOMMAND) $(DESTDIR)$(datadir)/applications/grafx2.desktop
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										111
									
								
								buttons.c
									
									
									
									
									
								
							
							
						
						
									
										111
									
								
								buttons.c
									
									
									
									
									
								
							@ -962,16 +962,33 @@ 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
 | 
					// Data for font selector
 | 
				
			||||||
char is_font(const char* name)
 | 
					T_Fileselector Font_files_list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					char * Format_font_filename(const char * fname)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return name[0]=='f' && name[1]=='o' && name[2]=='n' && name[3]=='t' 
 | 
					  static char result[12];
 | 
				
			||||||
		&& name[4]=='_';
 | 
					  int c;
 | 
				
			||||||
 | 
					  int length;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  fname+=5; // Assume "font_" prefix
 | 
				
			||||||
 | 
					  length=strlen(fname) - 4; // assume .png extension
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  for (c=0;c<11 && c<length ;c++)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    result[c]=fname[c];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  result[c]='\0';
 | 
				
			||||||
 | 
					  if (length>11)
 | 
				
			||||||
 | 
					    result[10] = ELLIPSIS_CHARACTER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Add a skin to the list
 | 
					// Add a skin to the list
 | 
				
			||||||
void Add_skin(const char *name)
 | 
					void Add_font_or_skin(const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const char * fname;
 | 
					  const char * fname;
 | 
				
			||||||
  int namelength;
 | 
					  int namelength;
 | 
				
			||||||
@ -983,7 +1000,7 @@ void Add_skin(const char *name)
 | 
				
			|||||||
  else
 | 
					  else
 | 
				
			||||||
    fname=name;
 | 
					    fname=name;
 | 
				
			||||||
  namelength = strlen(fname);
 | 
					  namelength = strlen(fname);
 | 
				
			||||||
  if (namelength>=5 && fname[0]!='_' && !is_font(fname) 
 | 
					  if (namelength>=10 && fname[0]!='_' && !strncmp(fname, "skin_", 5)
 | 
				
			||||||
	&& (!strcasecmp(fname+namelength-4,".png") 
 | 
						&& (!strcasecmp(fname+namelength-4,".png") 
 | 
				
			||||||
		|| !strcasecmp(fname+namelength-4,".gif")))
 | 
							|| !strcasecmp(fname+namelength-4,".gif")))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -992,12 +1009,25 @@ void Add_skin(const char *name)
 | 
				
			|||||||
    if (fname[0]=='\0')
 | 
					    if (fname[0]=='\0')
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Remove directory from full 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,
 | 
					    strcpy(Skin_files_list.First->Short_name,
 | 
				
			||||||
		Format_filename(Skin_files_list.First->Full_name, 0)
 | 
							Format_filename(Skin_files_list.First->Full_name, 0)
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  else if (namelength>=10 && !strncmp(fname, "font_", 5) && (!strcasecmp(fname+namelength-4,".png")))
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    Add_element_to_list(&Font_files_list, name, 0);  
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    if (fname[0]=='\0')
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Remove directory from full name
 | 
				
			||||||
 | 
					    strcpy(Font_files_list.First->Full_name, fname);
 | 
				
			||||||
 | 
					    // Reformat the short name differently
 | 
				
			||||||
 | 
					    strcpy(Font_files_list.First->Short_name,Format_font_filename(Font_files_list.First->Full_name));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1027,8 +1057,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 * cursors[] = { "Solid", "Transparent", "Thin" };
 | 
				
			||||||
  int nb_fonts = 4;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #define FILESEL_Y 52
 | 
					  #define FILESEL_Y 52
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1037,13 +1066,17 @@ void Button_Skins(void)
 | 
				
			|||||||
  // Here we use the same data container as the fileselectors.
 | 
					  // Here we use the same data container as the fileselectors.
 | 
				
			||||||
  // Reinitialize the list
 | 
					  // Reinitialize the list
 | 
				
			||||||
  Free_fileselector_list(&Skin_files_list);
 | 
					  Free_fileselector_list(&Skin_files_list);
 | 
				
			||||||
 | 
					  Free_fileselector_list(&Font_files_list);
 | 
				
			||||||
  // Browse the "skins" directory
 | 
					  // Browse the "skins" directory
 | 
				
			||||||
  strcpy(skinsdir,Data_directory);
 | 
					  strcpy(skinsdir,Data_directory);
 | 
				
			||||||
  strcat(skinsdir,"skins");
 | 
					  strcat(skinsdir,"skins");
 | 
				
			||||||
  // Add each found file to the list
 | 
					  // Add each found file to the list
 | 
				
			||||||
  For_each_file(skinsdir, Add_skin);
 | 
					  For_each_file(skinsdir, Add_font_or_skin);
 | 
				
			||||||
  // Sort it
 | 
					  // Sort it
 | 
				
			||||||
  Sort_list_of_files(&Skin_files_list);
 | 
					  Sort_list_of_files(&Skin_files_list);
 | 
				
			||||||
 | 
					  Sort_list_of_files(&Font_files_list);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  //selected_font = Find_file_in_fileselector(&Font_files_list, Config_choisie.Font_name);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // --------------------------------------------------------------
 | 
					  // --------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1068,35 +1101,19 @@ void Button_Skins(void)
 | 
				
			|||||||
		Skin_files_list.Nb_elements,10,selector_position)), // 3
 | 
							Skin_files_list.Nb_elements,10,selector_position)), // 3
 | 
				
			||||||
    Draw_one_skin_name); // 4
 | 
					    Draw_one_skin_name); // 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Font dropdown
 | 
					  // Buttons to choose a font
 | 
				
			||||||
  font_dropdown = Window_set_dropdown_button(60,19,86,11,0, 
 | 
					  font_dropdown = Window_set_dropdown_button(60,19,104,11,0, Get_item_by_index(&Font_files_list,selected_font)->Short_name,1,0,1,RIGHT_SIDE|LEFT_SIDE); // 5
 | 
				
			||||||
		fonts[selected_font],1,0,1,RIGHT_SIDE|LEFT_SIDE); // 5
 | 
					  for (temp=0; temp<Font_files_list.Nb_files; temp++)
 | 
				
			||||||
  for (temp=0; temp<nb_fonts; temp++)
 | 
					    Window_dropdown_add_item(font_dropdown,temp,Get_item_by_index(&Font_files_list,temp)->Short_name);
 | 
				
			||||||
    Window_dropdown_add_item(font_dropdown,temp,fonts[temp]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Cancel
 | 
					  // Cancel
 | 
				
			||||||
  Window_set_normal_button(62,136, 51,14,"Cancel",0,1,SDLK_ESCAPE); // 6
 | 
					  Window_set_normal_button(62,136, 51,14,"Cancel",0,1,SDLK_ESCAPE); // 6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Button item du curseur
 | 
					  // Dropdown list to choose cursor type
 | 
				
			||||||
  if(Config_choisie.Cursor==0)
 | 
					  cursor_dropdown = Window_set_dropdown_button(60,34,104,11,0,cursors[Config_choisie.Cursor],1,0,1,RIGHT_SIDE|LEFT_SIDE); // 7
 | 
				
			||||||
  	cursor_dropdown = Window_set_dropdown_button(60,34,104,11,0,"Solid      ",1,0,1,RIGHT_SIDE|LEFT_SIDE); // 7
 | 
					  for (temp=0; temp<3; temp++)
 | 
				
			||||||
  else if(Config_choisie.Cursor==1)
 | 
					    Window_dropdown_add_item(cursor_dropdown,temp,cursors[temp]);
 | 
				
			||||||
  	cursor_dropdown = Window_set_dropdown_button(60,34,104,11,0,"Transparent",1,0,1,RIGHT_SIDE|LEFT_SIDE); // 7
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
  	cursor_dropdown = Window_set_dropdown_button(60,34,104,11,0,"Thin       ",1,0,1,RIGHT_SIDE|LEFT_SIDE); // 7
 | 
					 | 
				
			||||||
  Window_dropdown_add_item(cursor_dropdown,0,"Solid      ");
 | 
					 | 
				
			||||||
  Window_dropdown_add_item(cursor_dropdown,1,"Transparent");
 | 
					 | 
				
			||||||
  Window_dropdown_add_item(cursor_dropdown,2,"Thin       ");
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // Select the current skin (we know it does exist, so no need to do a 
 | 
					 | 
				
			||||||
  // nearest match search)
 | 
					 | 
				
			||||||
  //Highlight_file(Config_choisie.SkinFile);
 | 
					 | 
				
			||||||
  // On efface les anciens noms de fichier:
 | 
					 | 
				
			||||||
  //Window_rectangle(8-1,FILESEL_Y-1,144+2,80+2,MC_Black);
 | 
					 | 
				
			||||||
  // On affiche les nouveaux:
 | 
					 | 
				
			||||||
  //Display_skins_list(Main_fileselector_position,Main_fileselector_offset);
 | 
					 | 
				
			||||||
  Window_redraw_list(skin_list);
 | 
					  Window_redraw_list(skin_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Update_window_area(0,0,Window_width, Window_height);
 | 
					  Update_window_area(0,0,Window_width, Window_height);
 | 
				
			||||||
@ -1242,13 +1259,8 @@ void Button_Skins(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if(clicked_button == 1)
 | 
					  if(clicked_button == 1)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
	char* tmp_font;
 | 
					 | 
				
			||||||
	char* tmp_ptr;
 | 
					 | 
				
			||||||
    T_Gui_skin * gfx;
 | 
					    T_Gui_skin * gfx;
 | 
				
			||||||
 	  strcpy(skinsdir,"skins/");
 | 
					    strcpy(skinsdir, Get_item_by_index(&Skin_files_list, skin_list->List_start+skin_list->Cursor_position)->Full_name);
 | 
				
			||||||
    strcat(   	  
 | 
					 | 
				
			||||||
 	    skinsdir,
 | 
					 | 
				
			||||||
 	    Get_item_by_index(&Skin_files_list, skin_list->List_start+skin_list->Cursor_position)->Full_name);
 | 
					 | 
				
			||||||
	  gfx=Load_graphics(skinsdir);
 | 
						  gfx=Load_graphics(skinsdir);
 | 
				
			||||||
	  if (gfx == NULL) // Error
 | 
						  if (gfx == NULL) // Error
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -1257,30 +1269,21 @@ void Button_Skins(void)
 | 
				
			|||||||
	  else
 | 
						  else
 | 
				
			||||||
	  {
 | 
						  {
 | 
				
			||||||
	    byte * new_font;
 | 
						    byte * new_font;
 | 
				
			||||||
	    
 | 
					 | 
				
			||||||
      free(Gfx);
 | 
					      free(Gfx);
 | 
				
			||||||
      Gfx = gfx;
 | 
					      Gfx = gfx;
 | 
				
			||||||
  	  // Font selection
 | 
					  	  // Font selection
 | 
				
			||||||
	  tmp_font = strdup(fonts[selected_font]);
 | 
					  	  new_font = Load_font(Get_item_by_index(&Font_files_list,selected_font)->Full_name);
 | 
				
			||||||
	  tmp_ptr=tmp_font;
 | 
					 | 
				
			||||||
	  while(*tmp_ptr!=' ' && *tmp_ptr!='\0')
 | 
					 | 
				
			||||||
		  tmp_ptr++;
 | 
					 | 
				
			||||||
	  *tmp_ptr='\0';
 | 
					 | 
				
			||||||
  	  new_font = Load_font(tmp_font);
 | 
					 | 
				
			||||||
	  free(tmp_font);
 | 
					 | 
				
			||||||
  	  if (new_font)
 | 
					  	  if (new_font)
 | 
				
			||||||
  	  {
 | 
					  	  {
 | 
				
			||||||
 | 
					  	    const char * fname;
 | 
				
			||||||
  	    free(Menu_font);
 | 
					  	    free(Menu_font);
 | 
				
			||||||
  	    Menu_font = new_font;
 | 
					  	    Menu_font = new_font;
 | 
				
			||||||
  	    free (Config_choisie.Font_name);
 | 
					  	    free (Config_choisie.Font_name);
 | 
				
			||||||
  	    Config_choisie.Font_name = (char *)malloc(strlen(fonts[selected_font])+1);
 | 
					  	    fname = Get_item_by_index(&Font_files_list,selected_font)->Full_name;
 | 
				
			||||||
  	    if (Config_choisie.Font_name)
 | 
					  	    Config_choisie.Font_name = strdup(fname);
 | 
				
			||||||
  	    {
 | 
					 | 
				
			||||||
  	      strcpy(Config_choisie.Font_name,fonts[selected_font]);
 | 
					 | 
				
			||||||
  	    }
 | 
					 | 
				
			||||||
  	  }
 | 
					  	  }
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
	    strcpy(Config_choisie.SkinFile,skinsdir+6);
 | 
						    strcpy(Config_choisie.SkinFile,skinsdir);
 | 
				
			||||||
	  }
 | 
						  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	  Config = Config_choisie ;
 | 
						  Config = Config_choisie ;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										7
									
								
								engine.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								engine.c
									
									
									
									
									
								
							@ -2289,8 +2289,11 @@ short Window_dropdown_on_click(T_Dropdown_button *Button)
 | 
				
			|||||||
    Window_attribute2=item->Number;
 | 
					    Window_attribute2=item->Number;
 | 
				
			||||||
    if (Button->Display_choice)
 | 
					    if (Button->Display_choice)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      // Mettre à jour automatiquement le libellé de la dropdown
 | 
					      // Automatically update the label of the dropdown list.
 | 
				
			||||||
      Print_in_window(Button->Pos_X+2,Button->Pos_Y+(Button->Height-7)/2,item->Label,MC_Black,MC_Light);
 | 
					      int text_length = (Button->Width-4-(Button->Display_arrow?8:0))/8;
 | 
				
			||||||
 | 
					      // Clear original label area
 | 
				
			||||||
 | 
					      Window_rectangle(Button->Pos_X+2,Button->Pos_Y+(Button->Height-7)/2,text_length*8,8,MC_Light);
 | 
				
			||||||
 | 
					      Print_in_window_limited(Button->Pos_X+2,Button->Pos_Y+(Button->Height-7)/2,item->Label,text_length ,MC_Black,MC_Light);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return Button->Number;
 | 
					    return Button->Number;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -462,9 +462,8 @@ void Sort_list_of_files(T_Fileselector *list)
 | 
				
			|||||||
  T_Fileselector_item * next_item;
 | 
					  T_Fileselector_item * next_item;
 | 
				
			||||||
  T_Fileselector_item * next_to_next_item;
 | 
					  T_Fileselector_item * next_to_next_item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Avant de trier quoi que ce soit, on vérifie qu'il y ait suffisamment
 | 
					  // Check there are at least two elements before sorting
 | 
				
			||||||
  // d'éléments pour qu'il soit possibles qu'ils soient en désordre:
 | 
					  if (list->First && list->First->Next)
 | 
				
			||||||
  if (list->Nb_elements>1)
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    do
 | 
					    do
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
@ -38,3 +38,5 @@ void Sort_list_of_files(T_Fileselector *list);
 | 
				
			|||||||
void Recount_files(T_Fileselector *list);
 | 
					void Recount_files(T_Fileselector *list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
T_Fileselector_item * Get_item_by_index(T_Fileselector *list, short index);
 | 
					T_Fileselector_item * Get_item_by_index(T_Fileselector *list, short index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					short Find_file_in_fileselector(T_Fileselector *list, char * fname);
 | 
				
			||||||
 | 
				
			|||||||
@ -318,7 +318,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  ; Name of the skinfile you want to  | Nom du fichier skin que vous voulez
 | 
					  ; Name of the skinfile you want to  | Nom du fichier skin que vous voulez
 | 
				
			||||||
  ; use.                              | utiliser.
 | 
					  ; use.                              | utiliser.
 | 
				
			||||||
  ; default 'modern.png'
 | 
					  ; default 'skin_modern.png'
 | 
				
			||||||
  Skin_file = modern.png
 | 
					  Skin_file = skin_modern.png
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ; end of configuration
 | 
					  ; end of configuration
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										3
									
								
								init.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								init.c
									
									
									
									
									
								
							@ -772,6 +772,7 @@ T_Gui_skin * Load_graphics(const char * skin_file)
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  // Read the "skin" file
 | 
					  // Read the "skin" file
 | 
				
			||||||
  strcpy(filename,Data_directory);
 | 
					  strcpy(filename,Data_directory);
 | 
				
			||||||
 | 
					  strcat(filename,"skins" PATH_SEPARATOR);
 | 
				
			||||||
  strcat(filename,skin_file);
 | 
					  strcat(filename,skin_file);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  gui=IMG_Load(filename);
 | 
					  gui=IMG_Load(filename);
 | 
				
			||||||
@ -848,7 +849,7 @@ byte * Load_font(const char * font_name)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // Read the file containing the image
 | 
					  // Read the file containing the image
 | 
				
			||||||
  sprintf(filename,"%sskins%sfont_%s.png", Data_directory, PATH_SEPARATOR, font_name);
 | 
					  sprintf(filename,"%sskins%s%s", Data_directory, PATH_SEPARATOR, font_name);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  image=IMG_Load(filename);
 | 
					  image=IMG_Load(filename);
 | 
				
			||||||
  if (!image)
 | 
					  if (!image)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.c
									
									
									
									
									
								
							@ -76,7 +76,7 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// filename for the current GUI skin file.
 | 
					// filename for the current GUI skin file.
 | 
				
			||||||
static char Gui_skin_file[MAX_PATH_CHARACTERS]= "skins" PATH_SEPARATOR ;
 | 
					static char Gui_skin_file[MAX_PATH_CHARACTERS];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//--- Affichage de la syntaxe, et de la liste des modes vidéos disponibles ---
 | 
					//--- Affichage de la syntaxe, et de la liste des modes vidéos disponibles ---
 | 
				
			||||||
void Display_syntax(void)
 | 
					void Display_syntax(void)
 | 
				
			||||||
@ -534,13 +534,17 @@ int Init_program(int argc,char * argv[])
 | 
				
			|||||||
  Analyze_command_line(argc,argv);
 | 
					  Analyze_command_line(argc,argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Load sprites, palette etc.
 | 
					  // Load sprites, palette etc.
 | 
				
			||||||
  strcpy(Gui_skin_file+6,Config.SkinFile);
 | 
					  strcpy(Gui_skin_file,Config.SkinFile);
 | 
				
			||||||
  Gfx = Load_graphics(Gui_skin_file);
 | 
					  Gfx = Load_graphics(Gui_skin_file);
 | 
				
			||||||
  if (Gfx == NULL)
 | 
					  if (Gfx == NULL)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    Gfx = Load_graphics("skin_modern.png");
 | 
				
			||||||
 | 
					    if (Gfx == NULL)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      printf("%s", Gui_loading_error_message);
 | 
					      printf("%s", Gui_loading_error_message);
 | 
				
			||||||
      Error(ERROR_GUI_MISSING);
 | 
					      Error(ERROR_GUI_MISSING);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  // Infos sur les trames (Sieve)
 | 
					  // Infos sur les trames (Sieve)
 | 
				
			||||||
  Sieve_mode=0;
 | 
					  Sieve_mode=0;
 | 
				
			||||||
  Copy_preset_sieve(0);
 | 
					  Copy_preset_sieve(0);
 | 
				
			||||||
@ -558,7 +562,7 @@ int Init_program(int argc,char * argv[])
 | 
				
			|||||||
  // Font
 | 
					  // Font
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    byte *font;
 | 
					    byte *font;
 | 
				
			||||||
    font = Load_font("Classic");
 | 
					    font = Load_font("font_Classic.png");
 | 
				
			||||||
    if (font)
 | 
					    if (font)
 | 
				
			||||||
      Menu_font=font;
 | 
					      Menu_font=font;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -818,7 +818,7 @@ int Load_INI(T_Config * conf)
 | 
				
			|||||||
  if(!Load_INI_get_string(file,buffer,"Skin_file",value_label,1))
 | 
					  if(!Load_INI_get_string(file,buffer,"Skin_file",value_label,1))
 | 
				
			||||||
	  strcpy(conf->SkinFile,value_label);
 | 
						  strcpy(conf->SkinFile,value_label);
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    strcpy(conf->SkinFile,"modern.png");
 | 
					    strcpy(conf->SkinFile,"skin_modern.png");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  fclose(file);
 | 
					  fclose(file);
 | 
				
			||||||
 | 
				
			|||||||
| 
		 Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB  | 
| 
		 Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB  | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user