escape non ascii chars to HEX \xNN in C source (not in comments)
add "" where needed. also fix extra space at end of lines (only in modified files)
This commit is contained in:
204
src/palette.c
204
src/palette.c
@@ -245,7 +245,7 @@ void Spread_colors(short start,short end,T_Palette palette)
|
||||
T_Components * backup_palette;
|
||||
T_Components * temp_palette;
|
||||
T_Components * working_palette;
|
||||
|
||||
|
||||
byte Palette_undo_state = 0;
|
||||
byte Palette_change_state = 0;
|
||||
|
||||
@@ -684,7 +684,7 @@ void Reduce_palette(short * used_colors,int nb_colors_asked,T_Palette palette,dw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Stop condition: when no more duplicates exist
|
||||
// and the number of colors has reached the target.
|
||||
if (best_difference!=0 && (*used_colors)<=nb_colors_asked)
|
||||
@@ -817,9 +817,9 @@ void Display_sliders(T_Scroller_button * red_slider,
|
||||
|
||||
if (block_is_selected)
|
||||
{
|
||||
Set_palette_slider(red_slider,Color_max*2+1,Color_max,"± 0",NUMERIC_R_X);
|
||||
Set_palette_slider(green_slider,Color_max*2+1,Color_max,"± 0",NUMERIC_G_X);
|
||||
Set_palette_slider(blue_slider,Color_max*2+1,Color_max,"± 0",NUMERIC_B_X);
|
||||
Set_palette_slider(red_slider,Color_max*2+1,Color_max,"\xb1 0",NUMERIC_R_X);
|
||||
Set_palette_slider(green_slider,Color_max*2+1,Color_max,"\xb1 0",NUMERIC_G_X);
|
||||
Set_palette_slider(blue_slider,Color_max*2+1,Color_max,"\xb1 0",NUMERIC_B_X);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -855,15 +855,15 @@ void Draw_all_palette_sliders(T_Scroller_button * red_slider,
|
||||
// Dans le cas d'un bloc, tout à 0.
|
||||
red_slider->Position =Color_max;
|
||||
Window_draw_slider(red_slider);
|
||||
Print_counter(NUMERIC_R_X,NUMERIC_Y,"± 0",MC_Black,MC_Light);
|
||||
Print_counter(NUMERIC_R_X,NUMERIC_Y,"\xb1 0",MC_Black,MC_Light);
|
||||
|
||||
green_slider->Position =Color_max;
|
||||
Window_draw_slider(green_slider);
|
||||
Print_counter(NUMERIC_G_X,NUMERIC_Y,"± 0",MC_Black,MC_Light);
|
||||
Print_counter(NUMERIC_G_X,NUMERIC_Y,"\xb1 0",MC_Black,MC_Light);
|
||||
|
||||
blue_slider->Position =Color_max;
|
||||
Window_draw_slider(blue_slider);
|
||||
Print_counter(NUMERIC_B_X,NUMERIC_Y,"± 0",MC_Black,MC_Light);
|
||||
Print_counter(NUMERIC_B_X,NUMERIC_Y,"\xb1 0",MC_Black,MC_Light);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -907,7 +907,7 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
|
||||
int clicked_button;
|
||||
|
||||
/* Draws an histogram of the selected range in a separate window */
|
||||
|
||||
|
||||
if (block_start == block_end) {
|
||||
// only one color selected: auto-detect the range
|
||||
for (block_start=0; block_start!=255; block_start++)
|
||||
@@ -930,7 +930,7 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
|
||||
Hide_cursor();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Open_window(263, 150, "Histogram");
|
||||
Window_set_normal_button(120, 130, 42, 14, "Close",-1,1,SDLK_RETURN);
|
||||
|
||||
@@ -948,13 +948,13 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
|
||||
// Draw at least one pixel if the color is used
|
||||
if (height==0)
|
||||
height=1;
|
||||
|
||||
|
||||
Window_rectangle(
|
||||
3+j*bar_width,
|
||||
127-height,
|
||||
bar_width,
|
||||
height, i);
|
||||
|
||||
|
||||
//if (i == MC_Light) {
|
||||
Window_rectangle(
|
||||
3+j*bar_width,
|
||||
@@ -976,7 +976,7 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
|
||||
126-old_height,
|
||||
1,
|
||||
old_height-height+1,MC_Black);
|
||||
|
||||
|
||||
old_height=height;
|
||||
j++;
|
||||
}
|
||||
@@ -1003,12 +1003,12 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
|
||||
}
|
||||
else
|
||||
new_hovered_color=-1;
|
||||
|
||||
|
||||
// When changing hovered color, update the info area
|
||||
if (new_hovered_color!=hovered_color)
|
||||
{
|
||||
char str[12];
|
||||
|
||||
|
||||
hovered_color=new_hovered_color;
|
||||
Hide_cursor();
|
||||
if (hovered_color==-1)
|
||||
@@ -1034,10 +1034,10 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
|
||||
clicked_button=Window_clicked_button();
|
||||
if (Key == KEY_ESC)
|
||||
clicked_button=1;
|
||||
|
||||
|
||||
} while( clicked_button < 1);
|
||||
Close_window();
|
||||
|
||||
|
||||
if (clicked_button==2)
|
||||
{
|
||||
// This is a counter-hack. Close_window() sets Mouse_K to zero
|
||||
@@ -1046,7 +1046,7 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
|
||||
// Here I force it back to 1, so that the Wait_end_of_click()
|
||||
// will really wait for a release of mouse button.
|
||||
Mouse_K=1;
|
||||
return hovered_color;
|
||||
return hovered_color;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -1067,7 +1067,7 @@ void Tag_used_colors(byte color, dword color_usage[])
|
||||
short x_pos=Window_palette_button_list->Pos_X+6+((index>>4)*10);
|
||||
short y_pos=Window_palette_button_list->Pos_Y+3+((index&15)* 5);
|
||||
byte col;
|
||||
|
||||
|
||||
col=(color&&color_usage[index])?MC_White:MC_Light;
|
||||
Window_rectangle(x_pos+5,y_pos+0,1,5,col);
|
||||
}
|
||||
@@ -1093,12 +1093,12 @@ void Button_Palette(int btn)
|
||||
static const int FGCOLOR_DISPLAY_Y = 69;
|
||||
static const int FGCOLOR_DISPLAY_W = 32;
|
||||
static const int FGCOLOR_DISPLAY_H = 88;
|
||||
|
||||
|
||||
// Coordinates of the Color#
|
||||
static const int COLOR_X = 111;
|
||||
static const int COLOR_Y = 79;
|
||||
|
||||
|
||||
|
||||
|
||||
static short reduce_colors_number = 256;
|
||||
short temp_color; // Variable pouvant reservir pour différents calculs intermédiaires
|
||||
dword temp;
|
||||
@@ -1128,7 +1128,7 @@ void Button_Palette(int btn)
|
||||
//T_Components * backup_palette;
|
||||
//T_Components * temp_palette;
|
||||
//T_Components * working_palette;
|
||||
|
||||
|
||||
static byte show_used_colors=0;
|
||||
|
||||
static const int C1_X = 5;
|
||||
@@ -1224,7 +1224,7 @@ void Button_Palette(int btn)
|
||||
|
||||
Window_set_normal_button(C4_X,L2,C4_W,14,"Used",4,1,SDLK_d); // 15
|
||||
Window_set_normal_button(C1_X,L4,83,14,"Zap unused",0,1,SDLK_DELETE);//16
|
||||
|
||||
|
||||
Window_set_repeatable_button(BUTTON_PLUS_X, BUTTON_PLUS_Y,12,11,"+",0,1,SDLK_KP_PLUS); // 17
|
||||
Window_set_repeatable_button(BUTTON_MINUS_X,BUTTON_MINUS_Y,12,11,"-",0,1,SDLK_KP_MINUS); // 18
|
||||
|
||||
@@ -1241,7 +1241,7 @@ void Button_Palette(int btn)
|
||||
Window_dropdown_add_item(sort_dropdown, 0, "Hue/Light");
|
||||
Window_dropdown_add_item(sort_dropdown, 1, "Lightness");
|
||||
Window_dropdown_add_item(sort_dropdown, 2, "Histogram");
|
||||
|
||||
|
||||
Window_set_normal_button(NUMERIC_BOX_X,NUMERIC_BOX_Y,NUMERIC_BOX_W,NUMERIC_BOX_H,"" ,0,1,KEY_NONE); // 24
|
||||
// Button without outline
|
||||
Window_display_frame_mono(NUMERIC_BOX_X-1,NUMERIC_BOX_Y-1,NUMERIC_BOX_W+2,NUMERIC_BOX_H+2,MC_Light);
|
||||
@@ -1250,7 +1250,7 @@ void Button_Palette(int btn)
|
||||
|
||||
Window_set_normal_button( 44,178,35,14,"Load" ,1,1,SDLK_l); // 26
|
||||
Window_set_normal_button( 83,178,35,14,"Save" ,1,1,SDLK_s); // 27
|
||||
|
||||
|
||||
// Dessin des petits effets spéciaux pour les boutons [+] et [-]
|
||||
Draw_thingumajig(BUTTON_PLUS_X-5, BUTTON_PLUS_Y,MC_White,-1);
|
||||
Draw_thingumajig(BUTTON_MINUS_X+16,BUTTON_MINUS_Y,MC_Dark,+1);
|
||||
@@ -1260,16 +1260,16 @@ void Button_Palette(int btn)
|
||||
Update_color_count(&used_colors,color_usage);
|
||||
if (show_used_colors)
|
||||
Tag_used_colors(1, color_usage);
|
||||
|
||||
|
||||
Update_window_area(0,0,299,196);
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
old_mouse_x=Mouse_X;
|
||||
old_mouse_y=Mouse_Y;
|
||||
old_mouse_k=Mouse_K;
|
||||
clicked_button=Window_clicked_button();
|
||||
|
||||
|
||||
switch (clicked_button)
|
||||
{
|
||||
case 0 : // Nulle part
|
||||
@@ -1301,19 +1301,19 @@ void Button_Palette(int btn)
|
||||
// Contextual menu
|
||||
T_Dropdown_button dropdown;
|
||||
T_Dropdown_choice *item;
|
||||
|
||||
|
||||
dropdown.Pos_X =0;
|
||||
dropdown.Pos_Y =0;
|
||||
dropdown.Height =0;
|
||||
dropdown.Dropdown_width=48;
|
||||
dropdown.First_item =NULL;
|
||||
dropdown.Bottom_up =1;
|
||||
|
||||
|
||||
Window_dropdown_add_item(&dropdown, 1, "Copy");
|
||||
Window_dropdown_add_item(&dropdown, 2, "Paste");
|
||||
|
||||
|
||||
item=Dropdown_activate(&dropdown,Mouse_X,Mouse_Y);
|
||||
|
||||
|
||||
if (item && item->Number == 1)
|
||||
{
|
||||
// Copy
|
||||
@@ -1324,10 +1324,10 @@ void Button_Palette(int btn)
|
||||
{
|
||||
// Paste
|
||||
int nb_colors;
|
||||
|
||||
|
||||
// Backup
|
||||
Palette_edit_step();
|
||||
|
||||
|
||||
nb_colors = Get_clipboard_colors(working_palette, block_start);
|
||||
if (nb_colors>0)
|
||||
{
|
||||
@@ -1345,7 +1345,7 @@ void Button_Palette(int btn)
|
||||
else if (Back_color!=temp_color)
|
||||
{
|
||||
// Just select back color
|
||||
|
||||
|
||||
Back_color=temp_color;
|
||||
// 4 blocks de back_color entourant la fore_color
|
||||
Window_rectangle(BGCOLOR_DISPLAY_X,BGCOLOR_DISPLAY_Y,BGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_Y-BGCOLOR_DISPLAY_Y,Back_color);
|
||||
@@ -1353,7 +1353,7 @@ void Button_Palette(int btn)
|
||||
Window_rectangle(BGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_X-BGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_H,Back_color);
|
||||
Window_rectangle(FGCOLOR_DISPLAY_X+FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_Y,BGCOLOR_DISPLAY_X+BGCOLOR_DISPLAY_W-FGCOLOR_DISPLAY_X-FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,Back_color);
|
||||
Update_window_area(BGCOLOR_DISPLAY_X,BGCOLOR_DISPLAY_Y,BGCOLOR_DISPLAY_W,BGCOLOR_DISPLAY_H);
|
||||
|
||||
|
||||
Display_cursor();
|
||||
}
|
||||
else
|
||||
@@ -1409,7 +1409,7 @@ void Button_Palette(int btn)
|
||||
Num2str(block_end ,str+4,3);
|
||||
str[3]=26; // Flèche vers la droite
|
||||
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
||||
|
||||
|
||||
// Affichage des jauges
|
||||
Display_sliders(red_slider,green_slider,blue_slider,1,NULL);
|
||||
|
||||
@@ -1426,7 +1426,7 @@ void Button_Palette(int btn)
|
||||
Num2str(block_end ,str+4,3);
|
||||
str[3]=26; // Flèche vers la droite
|
||||
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
||||
|
||||
|
||||
// Affichage des jauges
|
||||
Display_sliders(red_slider,green_slider,blue_slider,1,NULL);
|
||||
|
||||
@@ -1443,7 +1443,7 @@ void Button_Palette(int btn)
|
||||
Update_window_area(COLOR_X+24,COLOR_Y,32,7);
|
||||
Num2str(Fore_color,str,3);
|
||||
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
||||
|
||||
|
||||
// Affichage des jauges
|
||||
Display_sliders(red_slider,green_slider,blue_slider,0,working_palette);
|
||||
|
||||
@@ -1460,7 +1460,7 @@ void Button_Palette(int btn)
|
||||
}
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 2 : // Jauge rouge
|
||||
@@ -1472,7 +1472,7 @@ void Button_Palette(int btn)
|
||||
{
|
||||
Set_red(Fore_color,Decode_component(Color_max-red_slider->Position),working_palette);
|
||||
Format_component(Color_max-red_slider->Position,str);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HSL_to_RGB(
|
||||
@@ -1533,7 +1533,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_R_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
|
||||
@@ -1553,7 +1553,7 @@ void Button_Palette(int btn)
|
||||
{
|
||||
Set_green (Fore_color,Decode_component(Color_max-green_slider->Position),working_palette);
|
||||
Format_component(Color_max-green_slider->Position,str);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HSL_to_RGB(
|
||||
@@ -1584,7 +1584,7 @@ void Button_Palette(int btn)
|
||||
non_greys=1;
|
||||
else
|
||||
greys=1;
|
||||
|
||||
|
||||
for (i=block_start; i<=block_end; i++)
|
||||
{
|
||||
byte is_grey = temp_palette[i].R==temp_palette[i].G && temp_palette[i].R == temp_palette[i].B;
|
||||
@@ -1614,7 +1614,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_G_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
}
|
||||
@@ -1634,7 +1634,7 @@ void Button_Palette(int btn)
|
||||
{
|
||||
Set_blue (Fore_color,Decode_component(Color_max-blue_slider->Position),working_palette);
|
||||
Format_component(Color_max-blue_slider->Position,str);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HSL_to_RGB(
|
||||
@@ -1645,7 +1645,7 @@ void Button_Palette(int btn)
|
||||
&working_palette[Fore_color].G,
|
||||
&working_palette[Fore_color].B);
|
||||
Format_component((int)255-blue_slider->Position,str);
|
||||
}
|
||||
}
|
||||
Print_counter(NUMERIC_B_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
}
|
||||
else
|
||||
@@ -1665,7 +1665,7 @@ void Button_Palette(int btn)
|
||||
non_greys=1;
|
||||
else
|
||||
greys=1;
|
||||
|
||||
|
||||
for (i=block_start; i<=block_end; i++)
|
||||
{
|
||||
byte is_grey = temp_palette[i].R==temp_palette[i].G && temp_palette[i].R == temp_palette[i].B;
|
||||
@@ -1695,7 +1695,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_B_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
}
|
||||
@@ -1746,7 +1746,7 @@ void Button_Palette(int btn)
|
||||
{
|
||||
dword sum_r=0, sum_g=0, sum_b=0, used;
|
||||
Palette_edit_step();
|
||||
|
||||
|
||||
// Compute weighted average
|
||||
used=color_usage[temp_color]+color_usage[Fore_color];
|
||||
if (used)
|
||||
@@ -1773,7 +1773,7 @@ void Button_Palette(int btn)
|
||||
Set_red (Fore_color,sum_r,working_palette);
|
||||
Set_green(Fore_color,sum_g,working_palette);
|
||||
Set_blue (Fore_color,sum_b,working_palette);
|
||||
|
||||
|
||||
Wait_end_of_click();
|
||||
}
|
||||
}
|
||||
@@ -1855,14 +1855,14 @@ void Button_Palette(int btn)
|
||||
Tag_color_range(block_start,block_end);
|
||||
if (show_used_colors)
|
||||
Tag_used_colors(1, color_usage);
|
||||
|
||||
|
||||
need_to_remap=1;
|
||||
|
||||
Set_palette(working_palette);
|
||||
|
||||
Display_cursor();
|
||||
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
|
||||
|
||||
|
||||
// En cas de X-Swap, tout l'ecran a pu changer de couleur.
|
||||
if (clicked_button==8)
|
||||
{
|
||||
@@ -1908,7 +1908,7 @@ void Button_Palette(int btn)
|
||||
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
||||
// On tag le bloc (ou la couleur)
|
||||
Tag_color_range(block_start,block_end);
|
||||
|
||||
|
||||
need_to_remap=1;
|
||||
|
||||
Display_cursor();
|
||||
@@ -1952,13 +1952,13 @@ void Button_Palette(int btn)
|
||||
if (Window_attribute2==0) // User picked "other" choice
|
||||
{
|
||||
int choice;
|
||||
|
||||
|
||||
choice=Requester_window("Enter the max. number of colors",
|
||||
reduce_colors_number);
|
||||
|
||||
|
||||
if (choice < 2 || choice > 256)
|
||||
break; // Cancel
|
||||
|
||||
|
||||
reduce_colors_number = choice;
|
||||
}
|
||||
else
|
||||
@@ -2111,7 +2111,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_R_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
|
||||
@@ -2132,7 +2132,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_G_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
|
||||
@@ -2153,7 +2153,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_B_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
}
|
||||
@@ -2237,7 +2237,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_R_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
|
||||
@@ -2258,7 +2258,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_G_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
|
||||
@@ -2279,7 +2279,7 @@ void Button_Palette(int btn)
|
||||
else
|
||||
{
|
||||
// Jauge nulle:
|
||||
strcpy(str,"± 0");
|
||||
strcpy(str,"\xb1 0");
|
||||
}
|
||||
Print_counter(NUMERIC_B_X,NUMERIC_Y,str,MC_Black,MC_Light);
|
||||
}
|
||||
@@ -2319,14 +2319,14 @@ void Button_Palette(int btn)
|
||||
for (i=block_start; i < block_start + (block_end-block_start+1)/2;i++)
|
||||
{
|
||||
temp_color=block_end-(i-block_start);
|
||||
|
||||
|
||||
Set_red (i,backup_palette[temp_color].R,working_palette);
|
||||
Set_green (i,backup_palette[temp_color].G,working_palette);
|
||||
Set_blue (i,backup_palette[temp_color].B,working_palette);
|
||||
Set_red (temp_color,backup_palette[i].R,working_palette);
|
||||
Set_green (temp_color,backup_palette[i].G,working_palette);
|
||||
Set_blue (temp_color,backup_palette[i].B,working_palette);
|
||||
|
||||
|
||||
if (clicked_button==21)
|
||||
{
|
||||
conversion_table[i]=temp_color;
|
||||
@@ -2360,12 +2360,12 @@ void Button_Palette(int btn)
|
||||
break;
|
||||
|
||||
case 22 : // HSL <> RGB
|
||||
|
||||
|
||||
// Acte les changements en cours sur une ou plusieurs couleurs
|
||||
Palette_edit_select_range();
|
||||
|
||||
Hide_cursor();
|
||||
|
||||
|
||||
Palette_view_is_RGB = !Palette_view_is_RGB;
|
||||
if(! Palette_view_is_RGB)
|
||||
{
|
||||
@@ -2388,9 +2388,9 @@ void Button_Palette(int btn)
|
||||
Window_draw_normal_bouton(BUTTON_MINUS_X,BUTTON_MINUS_Y,12,11,"-",0,1);
|
||||
}
|
||||
Display_sliders(red_slider,green_slider,blue_slider,(block_start!=block_end),working_palette);
|
||||
|
||||
|
||||
Display_cursor();
|
||||
|
||||
|
||||
Update_window_area(BUTTON_PLUS_X-1,BUTTON_PLUS_Y-1,14,14);
|
||||
Update_window_area(BUTTON_MINUS_X-1,BUTTON_MINUS_Y-1,14,14);
|
||||
break;
|
||||
@@ -2417,7 +2417,7 @@ void Button_Palette(int btn)
|
||||
begin = block_start;
|
||||
end = block_end;
|
||||
}
|
||||
|
||||
|
||||
// Init remap table
|
||||
for (i=0;i<256;i++)
|
||||
remap_table[i]=i;
|
||||
@@ -2454,7 +2454,7 @@ void Button_Palette(int btn)
|
||||
SWAP_DWORDS(color_usage[temp_color], color_usage[temp_color-1])
|
||||
|
||||
SWAP_BYTES(remap_table[temp_color], remap_table[temp_color-1])
|
||||
|
||||
|
||||
swap=1;
|
||||
}
|
||||
}
|
||||
@@ -2467,7 +2467,7 @@ void Button_Palette(int btn)
|
||||
lightness=Perceptual_lightness(working_palette+begin);
|
||||
for(temp_color=begin+1;temp_color<=end;temp_color++)
|
||||
{
|
||||
old_lightness=lightness;
|
||||
old_lightness=lightness;
|
||||
lightness=Perceptual_lightness(working_palette+temp_color);
|
||||
|
||||
if(lightness>old_lightness)
|
||||
@@ -2476,11 +2476,11 @@ void Button_Palette(int btn)
|
||||
SWAP_BYTES(working_palette[temp_color].R, working_palette[temp_color-1].R)
|
||||
SWAP_BYTES(working_palette[temp_color].G, working_palette[temp_color-1].G)
|
||||
SWAP_BYTES(working_palette[temp_color].B, working_palette[temp_color-1].B)
|
||||
|
||||
|
||||
SWAP_DWORDS(color_usage[temp_color], color_usage[temp_color-1])
|
||||
|
||||
|
||||
SWAP_BYTES(remap_table[temp_color], remap_table[temp_color-1])
|
||||
|
||||
|
||||
swap=1;
|
||||
}
|
||||
}
|
||||
@@ -2493,7 +2493,7 @@ void Button_Palette(int btn)
|
||||
lightness=color_usage[begin];
|
||||
for(temp_color=begin+1;temp_color<=end;temp_color++)
|
||||
{
|
||||
old_lightness=lightness;
|
||||
old_lightness=lightness;
|
||||
lightness=color_usage[temp_color];
|
||||
|
||||
if(lightness>old_lightness)
|
||||
@@ -2502,11 +2502,11 @@ void Button_Palette(int btn)
|
||||
SWAP_BYTES(working_palette[temp_color].R, working_palette[temp_color-1].R)
|
||||
SWAP_BYTES(working_palette[temp_color].G, working_palette[temp_color-1].G)
|
||||
SWAP_BYTES(working_palette[temp_color].B, working_palette[temp_color-1].B)
|
||||
|
||||
|
||||
SWAP_DWORDS(color_usage[temp_color], color_usage[temp_color-1])
|
||||
|
||||
|
||||
SWAP_BYTES(remap_table[temp_color], remap_table[temp_color-1])
|
||||
|
||||
|
||||
swap=1;
|
||||
}
|
||||
}
|
||||
@@ -2519,7 +2519,7 @@ void Button_Palette(int btn)
|
||||
// palette, l'image et à l'écran.
|
||||
Set_palette(working_palette);
|
||||
Palette_edit_step(); // Disable Undo
|
||||
|
||||
|
||||
End_of_modification();
|
||||
need_to_remap=1;
|
||||
}
|
||||
@@ -2528,20 +2528,20 @@ void Button_Palette(int btn)
|
||||
{
|
||||
char str[7];
|
||||
unsigned int new_color;
|
||||
|
||||
|
||||
Hide_cursor();
|
||||
Print_in_window(NUMERIC_BOX_X+2,NUMERIC_BOX_Y+2,"Hex",MC_Black,MC_Light);
|
||||
// Clear out remaining area
|
||||
Window_rectangle(NUMERIC_BOX_X+1+3*8,NUMERIC_BOX_Y+1,NUMERIC_BOX_W-3-3*8, NUMERIC_BOX_H-3,MC_Light);
|
||||
Update_window_area(NUMERIC_BOX_X+1+3*8,NUMERIC_BOX_Y+1,NUMERIC_BOX_W-3-3*8, NUMERIC_BOX_H-3);
|
||||
|
||||
|
||||
str[0]='\0';
|
||||
Display_cursor();
|
||||
if (Readline(NUMERIC_BOX_X+NUMERIC_BOX_W-2-6*8, NUMERIC_BOX_Y+2, str, 6, INPUT_TYPE_HEXA))
|
||||
{
|
||||
int length = strlen(str);
|
||||
short new_red, new_blue, new_green;
|
||||
|
||||
|
||||
if (length==3 || length==6)
|
||||
{
|
||||
sscanf(str, "%x", &new_color);
|
||||
@@ -2550,12 +2550,12 @@ void Button_Palette(int btn)
|
||||
new_color =
|
||||
((new_color&0xF00)*0x1100) |
|
||||
((new_color&0x0F0)*0x110) |
|
||||
((new_color&0x00F)*0x11);
|
||||
((new_color&0x00F)*0x11);
|
||||
}
|
||||
new_red=(new_color&0xFF0000) >> 16;
|
||||
new_green=(new_color&0x00FF00) >> 8;
|
||||
new_blue=(new_color&0x0000FF);
|
||||
|
||||
|
||||
// Backup
|
||||
Palette_edit_step();
|
||||
// Assign color
|
||||
@@ -2578,32 +2578,32 @@ void Button_Palette(int btn)
|
||||
Draw_all_palette_sliders(red_slider,green_slider,blue_slider,working_palette,block_start,block_end);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 25: // Number of colors used: Open histogram
|
||||
{
|
||||
int selected_col;
|
||||
|
||||
|
||||
selected_col=Window_Histogram(block_start, block_end, color_usage);
|
||||
if (selected_col!=-1)
|
||||
{
|
||||
// Tag selected color
|
||||
Fore_color=first_color=last_color=block_start=block_end=selected_col;
|
||||
Tag_color_range(block_start,block_end);
|
||||
|
||||
|
||||
// Affichage du n° de la couleur sélectionnée
|
||||
Window_rectangle(COLOR_X,COLOR_Y,56,7,MC_Light);
|
||||
Num2str(Fore_color,str,3);
|
||||
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
||||
Update_window_area(COLOR_X,COLOR_Y,56,7);
|
||||
|
||||
|
||||
// Affichage des jauges
|
||||
Window_rectangle(NUMERIC_R_X,NUMERIC_Y,72,7,MC_Light);
|
||||
Display_sliders(red_slider,green_slider,blue_slider,0,working_palette);
|
||||
|
||||
|
||||
// Affichage dans le block de visu de la couleur en cours
|
||||
Window_rectangle(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,Fore_color);
|
||||
Update_window_area(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H);
|
||||
|
||||
|
||||
Palette_edit_select_range();
|
||||
|
||||
}
|
||||
@@ -2759,14 +2759,14 @@ void Button_Palette(int btn)
|
||||
Update_window_area(COLOR_X+24,COLOR_Y,32,7);
|
||||
Num2str(Fore_color,str,3);
|
||||
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
||||
|
||||
|
||||
// Affichage des jauges
|
||||
Display_sliders(red_slider,green_slider,blue_slider,0,working_palette);
|
||||
|
||||
// Affichage dans le block de visu de la couleur en cours
|
||||
Window_rectangle(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,Fore_color);
|
||||
Update_window_area(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H);
|
||||
|
||||
|
||||
Palette_edit_select_range();
|
||||
}
|
||||
Display_cursor();
|
||||
@@ -2795,7 +2795,7 @@ void Button_Palette(int btn)
|
||||
Hide_cursor();
|
||||
// Backup
|
||||
Palette_edit_step();
|
||||
|
||||
|
||||
nb_colors = Get_clipboard_colors(working_palette, block_start);
|
||||
if (nb_colors>0)
|
||||
{
|
||||
@@ -2821,7 +2821,7 @@ void Button_Palette(int btn)
|
||||
Tag_used_colors(1, color_usage);
|
||||
Window_rectangle(BGCOLOR_DISPLAY_X,BGCOLOR_DISPLAY_Y,BGCOLOR_DISPLAY_W,BGCOLOR_DISPLAY_H,Back_color);
|
||||
Update_window_area(BGCOLOR_DISPLAY_X,BGCOLOR_DISPLAY_Y,BGCOLOR_DISPLAY_W,BGCOLOR_DISPLAY_H);
|
||||
|
||||
|
||||
Display_grad_block_in_window(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,block_start,block_end);
|
||||
|
||||
Update_window_area(8,82,16*10,5*16);
|
||||
@@ -2927,7 +2927,7 @@ void Button_Secondary_palette(int btn)
|
||||
Print_in_window(51,108,"Vertical",MC_Dark,MC_Light);
|
||||
|
||||
Window_set_normal_button(190,82,18,14,"x2" , 1,1,SDLK_x); // 9
|
||||
Window_set_normal_button(137,82,18,14,"÷2" , 0,1,SDLK_w); // 10
|
||||
Window_set_normal_button(137,82,18,14,"\xf7""2" , 0,1,SDLK_w); // 10
|
||||
|
||||
gamma_slider = Window_set_horizontal_scroller_button(137,110,71,30, 1,Gamma*10);// 11
|
||||
Num2str(Gamma*10,str,2);
|
||||
@@ -2958,7 +2958,7 @@ void Button_Secondary_palette(int btn)
|
||||
// Column slider
|
||||
Num2str(256-Window_attribute2,str,3);
|
||||
Print_in_window(38,89,str,MC_Black,MC_Light);
|
||||
break;
|
||||
break;
|
||||
case 6:
|
||||
// Line slider
|
||||
Num2str(16-Window_attribute2,str,3);
|
||||
@@ -3019,7 +3019,7 @@ void Button_Secondary_palette(int btn)
|
||||
Close_window();
|
||||
Unselect_button(BUTTON_PALETTE);
|
||||
Display_cursor();
|
||||
|
||||
|
||||
if (clicked_button==4) // Cancel
|
||||
return;
|
||||
|
||||
@@ -3053,7 +3053,7 @@ void Button_Secondary_palette(int btn)
|
||||
// that this will not activate shade mode on exit.
|
||||
Shade_settings_menu();
|
||||
}
|
||||
|
||||
|
||||
if (palette_needs_redraw)
|
||||
{
|
||||
Change_palette_cells();
|
||||
@@ -3088,7 +3088,7 @@ void Set_clipboard_colors(int nb_colors, T_Components *colors)
|
||||
int Get_clipboard_colors(T_Palette palette, byte start_color)
|
||||
{
|
||||
int nb_colors = Palette_clipboard_count;
|
||||
|
||||
|
||||
if (nb_colors==0)
|
||||
return 0;
|
||||
|
||||
@@ -3109,7 +3109,7 @@ const T_Components * Favorite_GUI_color(byte color_index)
|
||||
{128,128,128}, // Grey
|
||||
{255,255,255}
|
||||
};
|
||||
|
||||
|
||||
if (RGB_scale==3)
|
||||
{
|
||||
// Check if ALL GUI colors are compatible with /rgb 3
|
||||
|
||||
Reference in New Issue
Block a user