366 if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, 1, NULL)) |
366 if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, 1, NULL)) |
367 _tree_to_plant = -1; |
367 _tree_to_plant = -1; |
368 break; |
368 break; |
369 |
369 |
370 case 16: /* place trees randomly over the landscape*/ |
370 case 16: /* place trees randomly over the landscape*/ |
371 LowerWindowWidget(w, 16); |
371 w->LowerWidget(16); |
372 w->autorepeat_timeout = 5; |
372 w->autorepeat_timeout = 5; |
373 SndPlayFx(SND_15_BEEP); |
373 SndPlayFx(SND_15_BEEP); |
374 PlaceTreesRandomly(); |
374 PlaceTreesRandomly(); |
375 MarkWholeScreenDirty(); |
375 MarkWholeScreenDirty(); |
376 break; |
376 break; |
1173 } else { |
1173 } else { |
1174 strecpy(orig_str_buf, _edit_str_buf, lastof(orig_str_buf)); |
1174 strecpy(orig_str_buf, _edit_str_buf, lastof(orig_str_buf)); |
1175 WP(w, querystr_d).orig = orig_str_buf; |
1175 WP(w, querystr_d).orig = orig_str_buf; |
1176 } |
1176 } |
1177 |
1177 |
1178 LowerWindowWidget(w, QUERY_STR_WIDGET_TEXT); |
1178 w->LowerWidget(QUERY_STR_WIDGET_TEXT); |
1179 WP(w, querystr_d).caption = caption; |
1179 WP(w, querystr_d).caption = caption; |
1180 WP(w, querystr_d).afilter = afilter; |
1180 WP(w, querystr_d).afilter = afilter; |
1181 InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, realmaxlen, maxwidth); |
1181 InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, realmaxlen, maxwidth); |
1182 } |
1182 } |
1183 |
1183 |
1547 case WE_TIMEOUT: |
1547 case WE_TIMEOUT: |
1548 /* This test protects against using widgets 11 and 12 which are only available |
1548 /* This test protects against using widgets 11 and 12 which are only available |
1549 * in those two saveload mode */ |
1549 * in those two saveload mode */ |
1550 if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break; |
1550 if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break; |
1551 |
1551 |
1552 if (IsWindowWidgetLowered(w, 11)) { /* Delete button clicked */ |
1552 if (w->IsWidgetLowered(11)) { /* Delete button clicked */ |
1553 if (!FiosDelete(WP(w,querystr_d).text.buf)) { |
1553 if (!FiosDelete(WP(w,querystr_d).text.buf)) { |
1554 ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0); |
1554 ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0); |
1555 } else { |
1555 } else { |
1556 BuildFileList(); |
1556 BuildFileList(); |
1557 /* Reset file name to current date on successfull delete */ |
1557 /* Reset file name to current date on successfull delete */ |
1558 if (_saveload_mode == SLD_SAVE_GAME) GenerateFileName(); |
1558 if (_saveload_mode == SLD_SAVE_GAME) GenerateFileName(); |
1559 } |
1559 } |
1560 |
1560 |
1561 UpdateTextBufferSize(&WP(w, querystr_d).text); |
1561 UpdateTextBufferSize(&WP(w, querystr_d).text); |
1562 w->SetDirty(); |
1562 w->SetDirty(); |
1563 } else if (IsWindowWidgetLowered(w, 12)) { /* Save button clicked */ |
1563 } else if (w->IsWidgetLowered(12)) { /* Save button clicked */ |
1564 _switch_mode = SM_SAVE; |
1564 _switch_mode = SM_SAVE; |
1565 FiosMakeSavegameName(_file_to_saveload.name, WP(w,querystr_d).text.buf, sizeof(_file_to_saveload.name)); |
1565 FiosMakeSavegameName(_file_to_saveload.name, WP(w,querystr_d).text.buf, sizeof(_file_to_saveload.name)); |
1566 |
1566 |
1567 /* In the editor set up the vehicle engines correctly (date might have changed) */ |
1567 /* In the editor set up the vehicle engines correctly (date might have changed) */ |
1568 if (_game_mode == GM_EDITOR) StartupEngines(); |
1568 if (_game_mode == GM_EDITOR) StartupEngines(); |
1643 w->widget[1].data = saveload_captions[mode]; |
1643 w->widget[1].data = saveload_captions[mode]; |
1644 w->vscroll.cap = 24; |
1644 w->vscroll.cap = 24; |
1645 w->resize.step_width = 2; |
1645 w->resize.step_width = 2; |
1646 w->resize.step_height = 10; |
1646 w->resize.step_height = 10; |
1647 w->resize.height = w->height - 14 * 10; // Minimum of 10 items |
1647 w->resize.height = w->height - 14 * 10; // Minimum of 10 items |
1648 LowerWindowWidget(w, 7); |
1648 w->LowerWidget(7); |
1649 |
1649 |
1650 WP(w, querystr_d).afilter = CS_ALPHANUMERAL; |
1650 WP(w, querystr_d).afilter = CS_ALPHANUMERAL; |
1651 InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 240); |
1651 InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 240); |
1652 |
1652 |
1653 // pause is only used in single-player, non-editor mode, non-menu mode. It |
1653 // pause is only used in single-player, non-editor mode, non-menu mode. It |