Load the favorite colors from the skin, not the ini file. We may want to override them, but for now just change the skin's palette.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1116 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									2b02ff505f
								
							
						
					
					
						commit
						49cce9643e
					
				
							
								
								
									
										36
									
								
								buttons.c
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								buttons.c
									
									
									
									
									
								
							@ -1057,6 +1057,14 @@ void Button_Skins(void)
 | 
			
		||||
  Sort_list_of_files(&Font_files_list);
 | 
			
		||||
  
 | 
			
		||||
  selected_font = Find_file_in_fileselector(&Font_files_list, Config.Font_file);
 | 
			
		||||
 | 
			
		||||
  // Do this before setting up the skin list because it will redraw itself using the old colors...
 | 
			
		||||
  Old_black = MC_Black;
 | 
			
		||||
  Old_dark = MC_Dark;
 | 
			
		||||
  Old_light = MC_Light;
 | 
			
		||||
  Old_white = MC_White;
 | 
			
		||||
  Old_trans = MC_Trans;
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  // --------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
@ -1117,12 +1125,6 @@ void Button_Skins(void)
 | 
			
		||||
 | 
			
		||||
  Display_cursor();
 | 
			
		||||
 | 
			
		||||
  Old_black = MC_Black;
 | 
			
		||||
  Old_dark = MC_Dark;
 | 
			
		||||
  Old_light = MC_Light;
 | 
			
		||||
  Old_white = MC_White;
 | 
			
		||||
  Old_trans = MC_Trans;
 | 
			
		||||
 | 
			
		||||
  do
 | 
			
		||||
  {
 | 
			
		||||
    clicked_button=Window_clicked_button();
 | 
			
		||||
@ -1217,31 +1219,17 @@ void Button_Skins(void)
 | 
			
		||||
	  Config.Display_image_limits = showlimits;
 | 
			
		||||
	  Config.Separate_colors = separatecolors;
 | 
			
		||||
 | 
			
		||||
	  // We loaded a new menu but not changed the palette
 | 
			
		||||
	  // So we have to remap FROM MC_ TO Old_ and not the reverse way...
 | 
			
		||||
	  SWAP_BYTES(Old_black, MC_Black);
 | 
			
		||||
	  SWAP_BYTES(Old_dark, MC_Dark);
 | 
			
		||||
	  SWAP_BYTES(Old_light, MC_Light);
 | 
			
		||||
	  SWAP_BYTES(Old_white, MC_White);
 | 
			
		||||
	  SWAP_BYTES(Old_trans, MC_Trans);
 | 
			
		||||
	  Remap_menu_sprites();
 | 
			
		||||
	  Old_black = MC_Black;
 | 
			
		||||
	  Old_dark = MC_Dark;
 | 
			
		||||
	  Old_light = MC_Light;
 | 
			
		||||
	  Old_white = MC_White;
 | 
			
		||||
	  Old_trans = MC_Trans;
 | 
			
		||||
	  // Now find the best colors for the new skin in the current palette
 | 
			
		||||
	  // and remap the skin
 | 
			
		||||
	  Compute_optimal_menu_colors(Main_palette);
 | 
			
		||||
 | 
			
		||||
  } else {
 | 
			
		||||
	  // Get the initial colors back
 | 
			
		||||
	  MC_Black = Old_black;
 | 
			
		||||
	  MC_Dark = Old_dark;
 | 
			
		||||
	  MC_Light = Old_light;
 | 
			
		||||
	  MC_White = Old_white;
 | 
			
		||||
	  MC_Trans = Old_trans;
 | 
			
		||||
 | 
			
		||||
	  // TODO : il faudrait aussi restaurer la preview du skin initial, soit ici
 | 
			
		||||
	  // soit la prochaine fois qu'on ouvre la fenêtre. Une solution est de
 | 
			
		||||
	  // ne pas utiliser une variable globale pour skin_logo mais de la mettre
 | 
			
		||||
	  // dans gfx à la place.
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Close_window();
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								init.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								init.c
									
									
									
									
									
								
							@ -272,6 +272,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
 | 
			
		||||
 | 
			
		||||
  // Carré "noir"
 | 
			
		||||
  MC_Black = Get_SDL_pixel_8(gui,cursor_x,cursor_y);
 | 
			
		||||
  Fav_menu_colors[0] = gfx->Default_palette[MC_Black];
 | 
			
		||||
  do
 | 
			
		||||
  {
 | 
			
		||||
    if (++cursor_x>=gui->w)
 | 
			
		||||
@ -283,6 +284,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
 | 
			
		||||
  } while(color==MC_Black);
 | 
			
		||||
  // Carré "foncé"
 | 
			
		||||
  MC_Dark=color;
 | 
			
		||||
  Fav_menu_colors[1] = gfx->Default_palette[MC_Dark];
 | 
			
		||||
  do
 | 
			
		||||
  {
 | 
			
		||||
    if (++cursor_x>=gui->w)
 | 
			
		||||
@ -294,6 +296,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
 | 
			
		||||
  } while(color==MC_Dark);
 | 
			
		||||
  // Carré "clair"
 | 
			
		||||
  MC_Light=color;
 | 
			
		||||
  Fav_menu_colors[2] = gfx->Default_palette[MC_Light];
 | 
			
		||||
  do
 | 
			
		||||
  {
 | 
			
		||||
    if (++cursor_x>gui->w)
 | 
			
		||||
@ -305,6 +308,7 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
 | 
			
		||||
  } while(color==MC_Light);
 | 
			
		||||
  // Carré "blanc"
 | 
			
		||||
  MC_White=color;
 | 
			
		||||
  Fav_menu_colors[3] = gfx->Default_palette[MC_White];
 | 
			
		||||
  do
 | 
			
		||||
  {
 | 
			
		||||
    if (++cursor_x>=gui->w)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								main.c
									
									
									
									
									
								
							@ -568,10 +568,11 @@ int Init_program(int argc,char * argv[])
 | 
			
		||||
 | 
			
		||||
  // Transfert des valeurs du .INI qui ne changent pas dans des variables
 | 
			
		||||
  // plus accessibles:
 | 
			
		||||
  Gfx->Default_palette[MC_Black]=Fav_menu_colors[0]=Config.Fav_menu_colors[0];
 | 
			
		||||
  Gfx->Default_palette[MC_Dark] =Fav_menu_colors[1]=Config.Fav_menu_colors[1];
 | 
			
		||||
  Gfx->Default_palette[MC_Light]=Fav_menu_colors[2]=Config.Fav_menu_colors[2];
 | 
			
		||||
  Gfx->Default_palette[MC_White]=Fav_menu_colors[3]=Config.Fav_menu_colors[3];
 | 
			
		||||
  // Let's load the colors from the skin instead !
 | 
			
		||||
  // Gfx->Default_palette[MC_Black]=Fav_menu_colors[0]=Config.Fav_menu_colors[0];
 | 
			
		||||
  // Gfx->Default_palette[MC_Dark] =Fav_menu_colors[1]=Config.Fav_menu_colors[1];
 | 
			
		||||
  // Gfx->Default_palette[MC_Light]=Fav_menu_colors[2]=Config.Fav_menu_colors[2];
 | 
			
		||||
  // Gfx->Default_palette[MC_White]=Fav_menu_colors[3]=Config.Fav_menu_colors[3];
 | 
			
		||||
  Compute_optimal_menu_colors(Gfx->Default_palette);
 | 
			
		||||
  Fore_color=MC_White;
 | 
			
		||||
  Back_color=MC_Black;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user