Allow closing window in more dialog

see http://pulkomandy.tk/projects/GrafX2/ticket/141
see e72bb8cab16a237f74db0cde1ed43e9f45ff0bd0
This commit is contained in:
Thomas Bernard 2019-08-14 23:24:12 +02:00
parent 7f4e1a10eb
commit 24fee41e41
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
4 changed files with 13 additions and 7 deletions

View File

@ -5208,12 +5208,14 @@ void Button_Text(int btn)
} }
clicked_button=Window_clicked_button(); clicked_button=Window_clicked_button();
if (Quit_is_required)
clicked_button = 12; // cancel
if (clicked_button==0) if (clicked_button==0)
{ {
if (Is_shortcut(Key,0x100+BUTTON_HELP)) if (Is_shortcut(Key,0x100+BUTTON_HELP))
Window_help(BUTTON_TEXT, NULL); Window_help(BUTTON_TEXT, NULL);
else if (Is_shortcut(Key,0x100+BUTTON_TEXT)) else if (Is_shortcut(Key,0x100+BUTTON_TEXT))
clicked_button=12; clicked_button = 12; // cancel
} }
switch(clicked_button) switch(clicked_button)
{ {

View File

@ -1155,6 +1155,8 @@ int L_InputBox(lua_State* L)
while (!close_window) while (!close_window)
{ {
if (Quit_is_required)
close_window = CONTROL_CANCEL;
clicked_button=Window_clicked_button(); clicked_button=Window_clicked_button();
if (clicked_button>0) if (clicked_button>0)
{ {
@ -1338,7 +1340,7 @@ int L_SelectBox(lua_State* L)
do do
{ {
clicked_button=Window_clicked_button(); clicked_button=Window_clicked_button();
} while (clicked_button<1 && Key != KEY_ESC); } while (clicked_button<1 && Key != KEY_ESC && !Quit_is_required);
Close_window(); Close_window();
Cursor_shape=CURSOR_SHAPE_HOURGLASS; Cursor_shape=CURSOR_SHAPE_HOURGLASS;
@ -2839,8 +2841,10 @@ void Button_Brush_Factory(void)
break; break;
} }
} while (clicked_button != 1 && clicked_button != 5); } while (clicked_button != 1 && clicked_button != 5 && !Quit_is_required);
if (Quit_is_required)
clicked_button = 1;
// Cancel // Cancel
if (clicked_button==1) if (clicked_button==1)
break; break;

View File

@ -2637,7 +2637,7 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
Timer_state=2; // On arrête le chrono Timer_state=2; // On arrête le chrono
} }
} }
while ( (!has_clicked_ok) && (clicked_button!=2) ); while ( (!has_clicked_ok) && (clicked_button!=2) && !Quit_is_required);
if (has_clicked_ok) if (has_clicked_ok)
{ {

View File

@ -337,7 +337,7 @@ void Button_Transform_menu(int btn)
break; break;
} }
} }
while (clicked_button<=0 || clicked_button>=8); while ((clicked_button<=0 || clicked_button>=8) && !Quit_is_required);
Close_window(); Close_window();
@ -345,7 +345,7 @@ void Button_Transform_menu(int btn)
if (Current_operation != OPERATION_SCROLL) if (Current_operation != OPERATION_SCROLL)
Unselect_button(btn); Unselect_button(btn);
if (clicked_button != 1) // 1 is Cancel if (clicked_button != 1 && !Quit_is_required) // 1 is Cancel
{ {
short old_width; short old_width;
short old_height; short old_height;