556 /* Switch back to the normal text ref. stack for NewGRF texts */ |
556 /* Switch back to the normal text ref. stack for NewGRF texts */ |
557 SwitchToNormalRefStack(); |
557 SwitchToNormalRefStack(); |
558 break; |
558 break; |
559 |
559 |
560 case WE_MOUSELOOP: |
560 case WE_MOUSELOOP: |
561 if (_right_button_down) DeleteWindow(w); |
561 if (_right_button_down) delete w; |
562 break; |
562 break; |
563 |
563 |
564 case WE_4: |
564 case WE_4: |
565 if (--_errmsg_duration == 0) DeleteWindow(w); |
565 if (--_errmsg_duration == 0) delete w; |
566 break; |
566 break; |
567 |
567 |
568 case WE_DESTROY: |
568 case WE_DESTROY: |
569 SetRedErrorSquare(0); |
569 SetRedErrorSquare(0); |
570 extern StringID _switch_mode_errorstr; |
570 extern StringID _switch_mode_errorstr; |
709 |
709 |
710 case WE_MOUSELOOP: |
710 case WE_MOUSELOOP: |
711 /* We can show tooltips while dragging tools. These are shown as long as |
711 /* We can show tooltips while dragging tools. These are shown as long as |
712 * we are dragging the tool. Normal tooltips work with rmb */ |
712 * we are dragging the tool. Normal tooltips work with rmb */ |
713 if (WP(w, tooltips_d).paramcount == 0 ) { |
713 if (WP(w, tooltips_d).paramcount == 0 ) { |
714 if (!_right_button_down) DeleteWindow(w); |
714 if (!_right_button_down) delete w; |
715 } else { |
715 } else { |
716 if (!_left_button_down) DeleteWindow(w); |
716 if (!_left_button_down) delete w; |
717 } |
717 } |
718 |
718 |
719 break; |
719 break; |
720 } |
720 } |
721 } |
721 } |
1181 break; |
1181 break; |
1182 |
1182 |
1183 case WE_KEYPRESS: |
1183 case WE_KEYPRESS: |
1184 switch (HandleEditBoxKey(w, qs, QUERY_STR_WIDGET_TEXT, e)) { |
1184 switch (HandleEditBoxKey(w, qs, QUERY_STR_WIDGET_TEXT, e)) { |
1185 case 1: goto press_ok; // Enter pressed, confirms change |
1185 case 1: goto press_ok; // Enter pressed, confirms change |
1186 case 2: DeleteWindow(w); break; // ESC pressed, closes window, abandons changes |
1186 case 2: delete w; break; // ESC pressed, closes window, abandons changes |
1187 } |
1187 } |
1188 break; |
1188 break; |
1189 |
1189 |
1190 case WE_DESTROY: // Call cancellation of query, if we have not handled it before |
1190 case WE_DESTROY: // Call cancellation of query, if we have not handled it before |
1191 if (!qs->handled && w->parent != NULL) { |
1191 if (!qs->handled && w->parent != NULL) { |
1294 case QUERY_WIDGET_YES: |
1294 case QUERY_WIDGET_YES: |
1295 q->calledback = true; |
1295 q->calledback = true; |
1296 if (q->proc != NULL) q->proc(w->parent, true); |
1296 if (q->proc != NULL) q->proc(w->parent, true); |
1297 /* Fallthrough */ |
1297 /* Fallthrough */ |
1298 case QUERY_WIDGET_NO: |
1298 case QUERY_WIDGET_NO: |
1299 DeleteWindow(w); |
1299 delete w; |
1300 break; |
1300 break; |
1301 } |
1301 } |
1302 break; |
1302 break; |
1303 |
1303 |
1304 case WE_KEYPRESS: // ESC closes the window, Enter confirms the action |
1304 case WE_KEYPRESS: // ESC closes the window, Enter confirms the action |
1579 |
1579 |
1580 SetFiosType(file->type); |
1580 SetFiosType(file->type); |
1581 ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name)); |
1581 ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name)); |
1582 ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title)); |
1582 ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title)); |
1583 |
1583 |
1584 DeleteWindow(w); |
1584 delete w; |
1585 } else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) { |
1585 } else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) { |
1586 SetFiosType(file->type); |
1586 SetFiosType(file->type); |
1587 ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name)); |
1587 ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name)); |
1588 ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title)); |
1588 ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title)); |
1589 |
1589 |
1590 DeleteWindow(w); |
1590 delete w; |
1591 ShowHeightmapLoad(); |
1591 ShowHeightmapLoad(); |
1592 } else { |
1592 } else { |
1593 /* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */ |
1593 /* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */ |
1594 ttd_strlcpy(WP(w, querystr_d).text.buf, file->title, WP(w, querystr_d).text.maxlength); |
1594 ttd_strlcpy(WP(w, querystr_d).text.buf, file->title, WP(w, querystr_d).text.maxlength); |
1595 UpdateTextBufferSize(&WP(w, querystr_d).text); |
1595 UpdateTextBufferSize(&WP(w, querystr_d).text); |
1618 } |
1618 } |
1619 break; |
1619 break; |
1620 |
1620 |
1621 case WE_KEYPRESS: |
1621 case WE_KEYPRESS: |
1622 if (e->we.keypress.keycode == WKC_ESC) { |
1622 if (e->we.keypress.keycode == WKC_ESC) { |
1623 DeleteWindow(w); |
1623 delete w; |
1624 return; |
1624 return; |
1625 } |
1625 } |
1626 |
1626 |
1627 if ((_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) && |
1627 if ((_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) && |
1628 HandleEditBoxKey(w, &WP(w, querystr_d), 10, e) == 1) { // Press Enter |
1628 HandleEditBoxKey(w, &WP(w, querystr_d), 10, e) == 1) { // Press Enter |