Added Ok and Cancel buttons in value requester. Don't do anything in palette screen if user enters strange value, not even a reduction to 256 as this drops unused colors.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1100 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
2a67c9bdce
commit
b0aa1dcbab
@ -1466,11 +1466,13 @@ void Button_Palette(void)
|
||||
reduce_colors_number
|
||||
= Requester_window("Enter the max. number of colors",
|
||||
reduce_colors_number);
|
||||
if (reduce_colors_number < 2 || reduce_colors_number > 256)
|
||||
reduce_colors_number = 256;
|
||||
if (reduce_colors_number < 2 || reduce_colors_number >= 256)
|
||||
reduce_colors_number = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (reduce_colors_number > 0)
|
||||
{
|
||||
if (!image_is_backed_up)
|
||||
{
|
||||
Backup();
|
||||
@ -1496,6 +1498,7 @@ void Button_Palette(void)
|
||||
|
||||
End_of_modification();
|
||||
need_to_remap = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: // Undo
|
||||
|
||||
@ -856,8 +856,10 @@ int Requester_window(char* message, int initial_value)
|
||||
Print_in_window((window_width>>1)-(strlen(message)<<2), 20, message,
|
||||
MC_Black, MC_Light);
|
||||
sprintf(str, "%d", initial_value);
|
||||
Window_set_input_button((window_width / 3) - 20, 37, 10); // 1
|
||||
Print_in_window((window_width / 3) - 18, 39, str, MC_Black, MC_Light);
|
||||
Window_set_input_button(10, 37, 4); // 1
|
||||
Print_in_window(11, 39, str, MC_Black, MC_Light);
|
||||
Window_set_normal_button(60 ,37,40,14,"OK",1,1,SDLK_y); // 2
|
||||
Window_set_normal_button(130,37,60,14,"Cancel" ,1,1,SDLK_n); // 3
|
||||
|
||||
Update_rect(Window_pos_X, Window_pos_Y, Menu_factor_X * window_width,
|
||||
Menu_factor_Y * 60);
|
||||
@ -867,7 +869,7 @@ int Requester_window(char* message, int initial_value)
|
||||
{
|
||||
clicked_button = Window_clicked_button();
|
||||
if (clicked_button == 1)
|
||||
Readline((window_width / 3) - 18, 39, str, 10, 1);
|
||||
Readline(11, 39, str, 4, 1);
|
||||
if (Key == SDLK_ESCAPE) clicked_button = 2;
|
||||
}
|
||||
while (clicked_button <= 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user