From e72bb8cab16a237f74db0cde1ed43e9f45ff0bd0 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Fri, 1 Feb 2019 01:09:50 +0100 Subject: [PATCH] Allow Windows Close (X) in more popup dialogs - Settings - Skins - Copy Page - Resolution - Gradients - Brush Effects - Brush menu - Effects - Help / About - Statistics - Palette - Palette Historgram - 2nd palette menu --- src/buttons.c | 20 ++++++++++---------- src/help.c | 4 ++-- src/palette.c | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/buttons.c b/src/buttons.c index 207ad8b0..64f8b8d9 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -1164,7 +1164,7 @@ void Button_Settings(int btn) else if (Is_shortcut(Key,0x100+BUTTON_SETTINGS)) clicked_button=4; } - while ( (clicked_button!=4) && (Key!=KEY_RETURN) ); + while ( (clicked_button!=4) && (Key!=KEY_RETURN) && !Quit_is_required); // Checks on change if (Config.Show_hidden_directories!=selected_config.Show_hidden_directories @@ -1490,7 +1490,7 @@ void Button_Skins(int btn) break; } } - while ( (clicked_button!=1) && (clicked_button !=6) && (Key != KEY_ESCAPE)); + while ( (clicked_button!=1) && (clicked_button !=6) && (Key != KEY_ESCAPE) && !Quit_is_required); if(clicked_button == 1) { @@ -1708,7 +1708,7 @@ void Button_Copy_page(int btn) else if (Is_shortcut(Key,0x200+BUTTON_PAGE)) clicked_button=6; } - while (clicked_button<=0); + while (clicked_button<=0 && !Quit_is_required); Close_window(); Display_cursor(); @@ -2174,7 +2174,7 @@ void Button_Resolution(int btn) } } - while ((clicked_button!=1) && (clicked_button!=2)); + while ((clicked_button!=1) && (clicked_button!=2) && !Quit_is_required); Close_window(); @@ -2823,7 +2823,7 @@ void Button_Gradients(int btn) } } } - while (clicked_button!=6 && clicked_button!=7); + while (clicked_button!=6 && clicked_button!=7 && !Quit_is_required); Close_window(); // The Grad rect operation uses the same button as Grad menu. @@ -4042,7 +4042,7 @@ void Button_Brush_FX(int btn) clicked_button=1; } } - while (clicked_button<=0); + while (clicked_button<=0 && Quit_is_required); Close_window(); Unselect_button(btn); @@ -4500,7 +4500,7 @@ void Button_Airbrush_menu(int btn) } } } - while ( (clicked_button!=1) && (clicked_button!=2) ); + while ( (clicked_button!=1) && (clicked_button!=2) && !Quit_is_required); Close_window(); @@ -4695,7 +4695,7 @@ void Button_Effects(int btn) do { - clicked_button=Window_clicked_button(); + clicked_button = Window_clicked_button(); if (Key==KEY_ESC || Is_shortcut(Key,0x100+BUTTON_EFFECTS)) { @@ -4958,9 +4958,9 @@ void Button_Effects(int btn) Display_cursor(); } } - while (clicked_button!=11); + while (clicked_button!=11 && !Quit_is_required); - if (exit_by_close_button) + if (exit_by_close_button || Quit_is_required) Close_window(); else Hide_cursor(); diff --git a/src/help.c b/src/help.c index e8f6bbf3..a4ee68b4 100644 --- a/src/help.c +++ b/src/help.c @@ -768,7 +768,7 @@ void Window_help(int section, const char *sub_section) if (Is_shortcut(Key,0x100+BUTTON_HELP)) clicked_button=1; } - while ((clicked_button!=1) && (Key!=KEY_RETURN)); + while ((clicked_button!=1) && (Key!=KEY_RETURN) && !Quit_is_required); Key=0; Close_window(); @@ -1057,7 +1057,7 @@ void Button_Stats(int btn) if (Is_shortcut(Key,0x200+BUTTON_HELP)) clicked_button=1; } - while ( (clicked_button!=1) && (Key!=KEY_RETURN) ); + while ( (clicked_button!=1) && (Key!=KEY_RETURN) && !Quit_is_required); if(Key==KEY_RETURN)Key=0; diff --git a/src/palette.c b/src/palette.c index 2e3beefb..008266ac 100644 --- a/src/palette.c +++ b/src/palette.c @@ -1036,7 +1036,7 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword* if (Key == KEY_ESC) clicked_button=1; - } while( clicked_button < 1); + } while( clicked_button < 1 && !Quit_is_required); Close_window(); if (clicked_button==2) @@ -1269,7 +1269,7 @@ void Button_Palette(int btn) old_mouse_x=Mouse_X; old_mouse_y=Mouse_Y; old_mouse_k=Mouse_K; - clicked_button=Window_clicked_button(); + clicked_button = Window_clicked_button(); switch (clicked_button) { @@ -2832,7 +2832,7 @@ void Button_Palette(int btn) } } } - while ((clicked_button!=13) && (clicked_button!=14)); + while ((clicked_button!=13) && (clicked_button!=14) && !Quit_is_required); if (clicked_button==14) // Sortie par OK { @@ -2862,7 +2862,7 @@ void Button_Palette(int btn) Display_cursor(); - if (clicked_button==13) // Sortie par CANCEL + if (clicked_button==13 || Quit_is_required) // CANCEL was clicked { Set_palette(Main.palette); if (image_is_backed_up) @@ -3009,7 +3009,7 @@ void Button_Secondary_palette(int btn) break; } } - while (clicked_button!=1 && clicked_button!=2 && clicked_button!=3 && clicked_button!=4); + while ((clicked_button <= 0 || clicked_button >= 5) && !Quit_is_required); // We need to get the sliders positions before closing the window, because they will be freed. palette_cols=256-columns_slider->Position; @@ -3021,7 +3021,7 @@ void Button_Secondary_palette(int btn) Unselect_button(BUTTON_PALETTE); Display_cursor(); - if (clicked_button==4) // Cancel + if (clicked_button==4 || Quit_is_required) // Cancel return; if (palette_vertical != Config.Palette_vertical)