diff --git a/src/filesel.c b/src/filesel.c index 3a1562df..f6cae8d3 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -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)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; diff --git a/src/palette.c b/src/palette.c index ce0887bd..1d95abc4 100644 --- a/src/palette.c +++ b/src/palette.c @@ -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; diff --git a/src/windows.c b/src/windows.c index 697f806d..052a0c13 100644 --- a/src/windows.c +++ b/src/windows.c @@ -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) + { + 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.