fix UI colors Remaping when several windows are open
This commit is contained in:
		
							parent
							
								
									2d26bb8a1f
								
							
						
					
					
						commit
						1c6a9e2db2
					
				@ -2201,15 +2201,18 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
 | 
			
		||||
 | 
			
		||||
  //   On restaure les données de l'image qui ont certainement été modifiées
 | 
			
		||||
  // par la preview.
 | 
			
		||||
  Set_palette(Main.palette);
 | 
			
		||||
  Back_color=initial_back_color;
 | 
			
		||||
  if (Windows_open <= 1)
 | 
			
		||||
  {
 | 
			
		||||
    Set_palette(Main.palette);  //TODO vrai backup?
 | 
			
		||||
 | 
			
		||||
  Compute_optimal_menu_colors(Main.palette);
 | 
			
		||||
    Compute_optimal_menu_colors(Main.palette);//TODO
 | 
			
		||||
  }
 | 
			
		||||
  temp=(Window_pos_Y+(Window_height*Menu_factor_Y)<Menu_Y_before_window);
 | 
			
		||||
 | 
			
		||||
  Close_window();
 | 
			
		||||
 | 
			
		||||
  if (temp)
 | 
			
		||||
  if (temp && Windows_open < 1)
 | 
			
		||||
    Display_menu();
 | 
			
		||||
 | 
			
		||||
  Unselect_button((load)?BUTTON_LOAD:BUTTON_SAVE);
 | 
			
		||||
 | 
			
		||||
@ -864,7 +864,7 @@ void Load_image(T_IO_Context *context)
 | 
			
		||||
      Backup_layers(LAYER_NONE);
 | 
			
		||||
      // Copy the loaded palette
 | 
			
		||||
      memcpy(Main_palette, context->Palette, sizeof(T_Palette));
 | 
			
		||||
      //memcpy(Main_backups->Pages->Palette, context->Palette, sizeof(T_Palette));
 | 
			
		||||
      memcpy(Main_backups->Pages->Palette, context->Palette, sizeof(T_Palette));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  else if (context->Type == CONTEXT_BRUSH && File_error==0)
 | 
			
		||||
@ -934,7 +934,7 @@ void Load_image(T_IO_Context *context)
 | 
			
		||||
    Set_palette(context->Palette);
 | 
			
		||||
    
 | 
			
		||||
    // Display palette preview
 | 
			
		||||
    if (Get_fileformat(context->Format)->Palette_only)
 | 
			
		||||
    if (Get_fileformat(context->Format)->Palette_only)  // TODO : OU nous somme dans le load du menu palette !
 | 
			
		||||
    {
 | 
			
		||||
      short index;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -2614,8 +2614,10 @@ void Button_Palette(void)
 | 
			
		||||
 | 
			
		||||
      case 26: // Load palette
 | 
			
		||||
        memcpy(backup_palette, Main_palette, sizeof(T_Palette));
 | 
			
		||||
        memcpy(Main_palette, working_palette, sizeof(T_Palette));
 | 
			
		||||
        Load_picture(CONTEXT_PALETTE);
 | 
			
		||||
        memcpy(working_palette, Main_palette, sizeof(T_Palette));
 | 
			
		||||
        Set_palette(working_palette);
 | 
			
		||||
        memcpy(temp_palette,working_palette,sizeof(T_Palette));
 | 
			
		||||
        memcpy(Main_palette, backup_palette, sizeof(T_Palette));
 | 
			
		||||
        need_to_remap=1;
 | 
			
		||||
 | 
			
		||||
@ -2910,7 +2910,8 @@ void Remap_screen_after_menu_colors_change(void)
 | 
			
		||||
{
 | 
			
		||||
  short index;
 | 
			
		||||
  byte  conversion_table[256];
 | 
			
		||||
  short temp/*,temp2*/;
 | 
			
		||||
  //short temp/*,temp2*/;
 | 
			
		||||
  int window_index, pos_y;
 | 
			
		||||
 | 
			
		||||
  if ( (MC_Light!=Old_light) || (MC_Dark!=Old_dark) || (MC_White!=Old_white) || (MC_Black !=Old_black )
 | 
			
		||||
    || (MC_Trans!=Old_trans) )
 | 
			
		||||
@ -2926,20 +2927,36 @@ void Remap_screen_after_menu_colors_change(void)
 | 
			
		||||
 | 
			
		||||
    // Remappage de l'écran
 | 
			
		||||
 | 
			
		||||
    temp=Window_height*Menu_factor_Y;
 | 
			
		||||
 | 
			
		||||
    Remap_screen(Window_pos_X, Window_pos_Y,
 | 
			
		||||
                 Window_width*Menu_factor_X,
 | 
			
		||||
                 (Window_pos_Y+temp<Menu_Y_before_window)?temp:Menu_Y_before_window-Window_pos_Y,
 | 
			
		||||
                 conversion_table);
 | 
			
		||||
    // remap only screen pixels covered by a window or the menu
 | 
			
		||||
    for (pos_y = 0; pos_y < Screen_height; pos_y++)
 | 
			
		||||
    {
 | 
			
		||||
      int min_x = 0xffff;
 | 
			
		||||
      int max_x = 0;
 | 
			
		||||
      if (Menu_is_visible_before_window && pos_y >= Menu_Y_before_window)
 | 
			
		||||
      {
 | 
			
		||||
        min_x = 0;
 | 
			
		||||
        max_x = Screen_width;
 | 
			
		||||
      }
 | 
			
		||||
      else for (window_index = 0; window_index < Windows_open; window_index++)
 | 
			
		||||
      {
 | 
			
		||||
        if (pos_y < Window_stack[window_index].Pos_Y
 | 
			
		||||
         || pos_y >= (Window_stack[window_index].Pos_Y + Window_stack[window_index].Height*Menu_factor_Y) )
 | 
			
		||||
          continue; // this window doesn't occupy this screen row
 | 
			
		||||
        if (min_x > Window_stack[window_index].Pos_X)
 | 
			
		||||
          min_x = Window_stack[window_index].Pos_X;
 | 
			
		||||
        if (max_x < (Window_stack[window_index].Pos_X + Window_stack[window_index].Width*Menu_factor_X))
 | 
			
		||||
          max_x = Window_stack[window_index].Pos_X + Window_stack[window_index].Width*Menu_factor_X;
 | 
			
		||||
      }
 | 
			
		||||
      if (max_x > min_x)
 | 
			
		||||
        Remap_screen(min_x, pos_y, max_x - min_x, 1, conversion_table);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Remap_window_backgrounds(conversion_table, 0, Screen_height);// TODO check
 | 
			
		||||
    if (Menu_is_visible_before_window)
 | 
			
		||||
    {
 | 
			
		||||
      Remap_screen(0, Menu_Y_before_window,
 | 
			
		||||
                   Screen_width, Screen_height-Menu_Y_before_window,
 | 
			
		||||
                   conversion_table);
 | 
			
		||||
      // Remappage de la partie du fond de la fenetre qui cacherait le menu...
 | 
			
		||||
      Remap_window_backgrounds(conversion_table, Menu_Y_before_window, Screen_height);
 | 
			
		||||
      //Remap_window_backgrounds(conversion_table, Menu_Y_before_window, Screen_height);
 | 
			
		||||
      // TODO remapper les parties de fenetres cachées par la fenetre "on top"
 | 
			
		||||
      /*
 | 
			
		||||
         Il faudrait peut-être remapper les pointillés délimitant l'image.
 | 
			
		||||
         Mais ça va être chiant parce qu'ils peuvent être affichés en mode Loupe.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user