src/misc_gui.cpp
branchcpp_gui
changeset 6235 5077e6ed3788
parent 6144 5a0ffbf27ced
child 6237 bce32e54c993
equal deleted inserted replaced
6234:42bf2d268a86 6235:5077e6ed3788
   275 		DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, 0);
   275 		DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, 0);
   276 	}	break;
   276 	}	break;
   277 	case WE_MOUSELOOP: /* Timer to scroll the text and adjust the new top */
   277 	case WE_MOUSELOOP: /* Timer to scroll the text and adjust the new top */
   278 		if (WP(w, scroller_d).counter++ % 3 == 0) {
   278 		if (WP(w, scroller_d).counter++ % 3 == 0) {
   279 			WP(w, scroller_d).height--;
   279 			WP(w, scroller_d).height--;
   280 			SetWindowDirty(w);
   280 			w->SetDirty();
   281 		}
   281 		}
   282 		break;
   282 		break;
   283 	}
   283 	}
   284 }
   284 }
   285 
   285 
   396 	case WE_TIMEOUT:
   396 	case WE_TIMEOUT:
   397 		RaiseWindowWidget(w, 16);
   397 		RaiseWindowWidget(w, 16);
   398 		break;
   398 		break;
   399 
   399 
   400 	case WE_ABORT_PLACE_OBJ:
   400 	case WE_ABORT_PLACE_OBJ:
   401 		RaiseWindowButtons(w);
   401 		w->RaiseButtons();
   402 		break;
   402 		break;
   403 	}
   403 	}
   404 }
   404 }
   405 
   405 
   406 static const Widget _build_trees_widgets[] = {
   406 static const Widget _build_trees_widgets[] = {
   527 					238);
   527 					238);
   528 		}
   528 		}
   529 		break;
   529 		break;
   530 
   530 
   531 	case WE_MOUSELOOP:
   531 	case WE_MOUSELOOP:
   532 		if (_right_button_down) DeleteWindow(w);
   532 		if (_right_button_down) w->Close();
   533 		break;
   533 		break;
   534 
   534 
   535 	case WE_4:
   535 	case WE_4:
   536 		if (--_errmsg_duration == 0) DeleteWindow(w);
   536 		if (--_errmsg_duration == 0) w->Close();
   537 		break;
   537 		break;
   538 
   538 
   539 	case WE_DESTROY:
   539 	case WE_DESTROY:
   540 		SetRedErrorSquare(0);
   540 		SetRedErrorSquare(0);
   541 		_switch_mode_errorstr = INVALID_STRING_ID;
   541 		_switch_mode_errorstr = INVALID_STRING_ID;
   543 
   543 
   544 	case WE_KEYPRESS:
   544 	case WE_KEYPRESS:
   545 		if (e->we.keypress.keycode == WKC_SPACE) {
   545 		if (e->we.keypress.keycode == WKC_SPACE) {
   546 			// Don't continue.
   546 			// Don't continue.
   547 			e->we.keypress.cont = false;
   547 			e->we.keypress.cont = false;
   548 			DeleteWindow(w);
   548 			w->Close();
   549 		}
   549 		}
   550 		break;
   550 		break;
   551 	}
   551 	}
   552 }
   552 }
   553 
   553 
   570 
   570 
   571 	if (_errmsg_message_1 != STR_013B_OWNED_BY || GetDParamX(_errmsg_decode_params,2) >= 8) {
   571 	if (_errmsg_message_1 != STR_013B_OWNED_BY || GetDParamX(_errmsg_decode_params,2) >= 8) {
   572 
   572 
   573 		if ( (x|y) != 0) {
   573 		if ( (x|y) != 0) {
   574 			pt = RemapCoords2(x, y);
   574 			pt = RemapCoords2(x, y);
   575 			vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
   575 			vp = Window::FindById(WC_MAIN_WINDOW, 0)->viewport;
   576 
   576 
   577 			// move x pos to opposite corner
   577 			// move x pos to opposite corner
   578 			pt.x = ((pt.x - vp->virtual_left) >> vp->zoom) + vp->left;
   578 			pt.x = ((pt.x - vp->virtual_left) >> vp->zoom) + vp->left;
   579 			pt.x = (pt.x < (_screen.width >> 1)) ? _screen.width - 260 : 20;
   579 			pt.x = (pt.x < (_screen.width >> 1)) ? _screen.width - 260 : 20;
   580 
   580 
   584 
   584 
   585 		} else {
   585 		} else {
   586 			pt.x = (_screen.width - 240) >> 1;
   586 			pt.x = (_screen.width - 240) >> 1;
   587 			pt.y = (_screen.height - 46) >> 1;
   587 			pt.y = (_screen.height - 46) >> 1;
   588 		}
   588 		}
   589 		w = AllocateWindow(pt.x, pt.y, 240, 46, ErrmsgWndProc, WC_ERRMSG, _errmsg_widgets);
   589 		w = Window::Allocate(pt.x, pt.y, 240, 46, ErrmsgWndProc, WC_ERRMSG, _errmsg_widgets);
   590 	} else {
   590 	} else {
   591 		if ( (x|y) != 0) {
   591 		if ( (x|y) != 0) {
   592 			pt = RemapCoords2(x, y);
   592 			pt = RemapCoords2(x, y);
   593 			vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
   593 			vp = Window::FindById(WC_MAIN_WINDOW, 0)->viewport;
   594 			pt.x = clamp(((pt.x - vp->virtual_left) >> vp->zoom) + vp->left - (334/2), 0, _screen.width - 334);
   594 			pt.x = clamp(((pt.x - vp->virtual_left) >> vp->zoom) + vp->left - (334/2), 0, _screen.width - 334);
   595 			pt.y = clamp(((pt.y - vp->virtual_top) >> vp->zoom) + vp->top - (137/2), 22, _screen.height - 137);
   595 			pt.y = clamp(((pt.y - vp->virtual_top) >> vp->zoom) + vp->top - (137/2), 22, _screen.height - 137);
   596 		} else {
   596 		} else {
   597 			pt.x = (_screen.width - 334) >> 1;
   597 			pt.x = (_screen.width - 334) >> 1;
   598 			pt.y = (_screen.height - 137) >> 1;
   598 			pt.y = (_screen.height - 137) >> 1;
   599 		}
   599 		}
   600 		w = AllocateWindow(pt.x, pt.y, 334, 137, ErrmsgWndProc, WC_ERRMSG, _errmsg_face_widgets);
   600 		w = Window::Allocate(pt.x, pt.y, 334, 137, ErrmsgWndProc, WC_ERRMSG, _errmsg_face_widgets);
   601 	}
   601 	}
   602 
   602 
   603 	w->desc_flags = WDF_STD_BTN | WDF_DEF_WIDGET;
   603 	w->desc_flags = WDF_STD_BTN | WDF_DEF_WIDGET;
   604 }
   604 }
   605 
   605 
   661 
   661 
   662 		case WE_MOUSELOOP:
   662 		case WE_MOUSELOOP:
   663 			/* We can show tooltips while dragging tools. These are shown as long as
   663 			/* We can show tooltips while dragging tools. These are shown as long as
   664 			 * we are dragging the tool. Normal tooltips work with rmb */
   664 			 * we are dragging the tool. Normal tooltips work with rmb */
   665 			if (WP(w, tooltips_d).paramcount == 0 ) {
   665 			if (WP(w, tooltips_d).paramcount == 0 ) {
   666 				if (!_right_button_down) DeleteWindow(w);
   666 				if (!_right_button_down) w->Close();
   667 			} else {
   667 			} else {
   668 				if (!_left_button_down) DeleteWindow(w);
   668 				if (!_left_button_down) w->Close();
   669 			}
   669 			}
   670 
   670 
   671 			break;
   671 			break;
   672 	}
   672 	}
   673 }
   673 }
   706 	 * go below window, flip it so it is shown above the cursor */
   706 	 * go below window, flip it so it is shown above the cursor */
   707 	y = clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, 22, _screen.height - 12);
   707 	y = clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, 22, _screen.height - 12);
   708 	if (y + br.height > _screen.height - 12) y = _cursor.pos.y + _cursor.offs.y - br.height - 5;
   708 	if (y + br.height > _screen.height - 12) y = _cursor.pos.y + _cursor.offs.y - br.height - 5;
   709 	x = clamp(_cursor.pos.x - (br.width >> 1), 0, _screen.width - br.width);
   709 	x = clamp(_cursor.pos.x - (br.width >> 1), 0, _screen.width - br.width);
   710 
   710 
   711 	w = AllocateWindow(x, y, br.width, br.height, TooltipsWndProc, WC_TOOLTIPS, _tooltips_widgets);
   711 	w = Window::Allocate(x, y, br.width, br.height, TooltipsWndProc, WC_TOOLTIPS, _tooltips_widgets);
   712 
   712 
   713 	WP(w, tooltips_d).string_id = str;
   713 	WP(w, tooltips_d).string_id = str;
   714 	assert(sizeof(WP(w, tooltips_d).params[0]) == sizeof(params[0]));
   714 	assert(sizeof(WP(w, tooltips_d).params[0]) == sizeof(params[0]));
   715 	memcpy(WP(w, tooltips_d).params, params, sizeof(WP(w, tooltips_d).params[0]) * paramcount);
   715 	memcpy(WP(w, tooltips_d).params, params, sizeof(WP(w, tooltips_d).params[0]) * paramcount);
   716 	WP(w, tooltips_d).paramcount = paramcount;
   716 	WP(w, tooltips_d).paramcount = paramcount;
   762 
   762 
   763 void CheckRedrawStationCoverage(const Window *w)
   763 void CheckRedrawStationCoverage(const Window *w)
   764 {
   764 {
   765 	if (_thd.dirty & 1) {
   765 	if (_thd.dirty & 1) {
   766 		_thd.dirty &= ~1;
   766 		_thd.dirty &= ~1;
   767 		SetWindowDirty(w);
   767 		w->SetDirty();
   768 	}
   768 	}
   769 }
   769 }
   770 
   770 
   771 void SetVScrollCount(Window *w, int num)
   771 void SetVScrollCount(Window *w, int num)
   772 {
   772 {
  1090 							HandleOnEditText(qs->text.buf);
  1090 							HandleOnEditText(qs->text.buf);
  1091 						}
  1091 						}
  1092 					}
  1092 					}
  1093 					/* Fallthrough */
  1093 					/* Fallthrough */
  1094 				case QUERY_STR_WIDGET_CANCEL:
  1094 				case QUERY_STR_WIDGET_CANCEL:
  1095 					DeleteWindow(w);
  1095 					w->Close();
  1096 					break;
  1096 					break;
  1097 			}
  1097 			}
  1098 			break;
  1098 			break;
  1099 
  1099 
  1100 		case WE_MOUSELOOP:
  1100 		case WE_MOUSELOOP:
  1102 			break;
  1102 			break;
  1103 
  1103 
  1104 		case WE_KEYPRESS:
  1104 		case WE_KEYPRESS:
  1105 			switch (HandleEditBoxKey(w, qs, QUERY_STR_WIDGET_TEXT, e)) {
  1105 			switch (HandleEditBoxKey(w, qs, QUERY_STR_WIDGET_TEXT, e)) {
  1106 				case 1: goto press_ok; /* Enter pressed, confirms change */
  1106 				case 1: goto press_ok; /* Enter pressed, confirms change */
  1107 				case 2: DeleteWindow(w); break; /* ESC pressed, closes window, abandons changes */
  1107 				case 2: w->Close(); break; /* ESC pressed, closes window, abandons changes */
  1108 			}
  1108 			}
  1109 			break;
  1109 			break;
  1110 
  1110 
  1111 		case WE_DESTROY: /* Call cancellation of query, if we have not handled it before */
  1111 		case WE_DESTROY: /* Call cancellation of query, if we have not handled it before */
  1112 			if (!qs->handled && w->parent != NULL) {
  1112 			if (!qs->handled && w->parent != NULL) {
  1216 				case QUERY_WIDGET_YES:
  1216 				case QUERY_WIDGET_YES:
  1217 					q->calledback = true;
  1217 					q->calledback = true;
  1218 					if (q->proc != NULL) q->proc(w->parent, true);
  1218 					if (q->proc != NULL) q->proc(w->parent, true);
  1219 					/* Fallthrough */
  1219 					/* Fallthrough */
  1220 				case QUERY_WIDGET_NO:
  1220 				case QUERY_WIDGET_NO:
  1221 					DeleteWindow(w);
  1221 					w->Close();
  1222 					break;
  1222 					break;
  1223 				}
  1223 				}
  1224 			break;
  1224 			break;
  1225 
  1225 
  1226 		case WE_KEYPRESS: /* ESC closes the window, Enter confirms the action */
  1226 		case WE_KEYPRESS: /* ESC closes the window, Enter confirms the action */
  1230 					q->calledback = true;
  1230 					q->calledback = true;
  1231 					if (q->proc != NULL) q->proc(w->parent, true);
  1231 					if (q->proc != NULL) q->proc(w->parent, true);
  1232 					/* Fallthrough */
  1232 					/* Fallthrough */
  1233 				case WKC_ESC:
  1233 				case WKC_ESC:
  1234 					e->we.keypress.cont = false;
  1234 					e->we.keypress.cont = false;
  1235 					DeleteWindow(w);
  1235 					w->Close();
  1236 					break;
  1236 					break;
  1237 			}
  1237 			}
  1238 			break;
  1238 			break;
  1239 
  1239 
  1240 		case WE_DESTROY: /* Call callback function (if any) on window close if not yet called */
  1240 		case WE_DESTROY: /* Call callback function (if any) on window close if not yet called */
  1276 void ShowQuery(StringID caption, StringID message, Window *parent, void (*callback)(Window*, bool))
  1276 void ShowQuery(StringID caption, StringID message, Window *parent, void (*callback)(Window*, bool))
  1277 {
  1277 {
  1278 	Window *w = AllocateWindowDesc(&_query_desc);
  1278 	Window *w = AllocateWindowDesc(&_query_desc);
  1279 	if (w == NULL) return;
  1279 	if (w == NULL) return;
  1280 
  1280 
  1281 	if (parent == NULL) parent = FindWindowById(WC_MAIN_WINDOW, 0);
  1281 	if (parent == NULL) parent = Window::FindById(WC_MAIN_WINDOW, 0);
  1282 	w->parent = parent;
  1282 	w->parent = parent;
  1283 	w->left = parent->left + (parent->width / 2) - (w->width / 2);
  1283 	w->left = parent->left + (parent->width / 2) - (w->width / 2);
  1284 	w->top = parent->top + (parent->height / 2) - (w->height / 2);
  1284 	w->top = parent->top + (parent->height / 2) - (w->height / 2);
  1285 
  1285 
  1286 	/* Create a backup of the variadic arguments to strings because it will be
  1286 	/* Create a backup of the variadic arguments to strings because it will be
  1466 		switch (e->we.click.widget) {
  1466 		switch (e->we.click.widget) {
  1467 		case 2: /* Sort save names by name */
  1467 		case 2: /* Sort save names by name */
  1468 			_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ?
  1468 			_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ?
  1469 				SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME;
  1469 				SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME;
  1470 			_savegame_sort_dirty = true;
  1470 			_savegame_sort_dirty = true;
  1471 			SetWindowDirty(w);
  1471 			w->SetDirty();
  1472 			break;
  1472 			break;
  1473 
  1473 
  1474 		case 3: /* Sort save names by date */
  1474 		case 3: /* Sort save names by date */
  1475 			_savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ?
  1475 			_savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ?
  1476 				SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE;
  1476 				SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE;
  1477 			_savegame_sort_dirty = true;
  1477 			_savegame_sort_dirty = true;
  1478 			SetWindowDirty(w);
  1478 			w->SetDirty();
  1479 			break;
  1479 			break;
  1480 
  1480 
  1481 		case 6: /* OpenTTD 'button', jumps to OpenTTD directory */
  1481 		case 6: /* OpenTTD 'button', jumps to OpenTTD directory */
  1482 			FiosBrowseTo(&o_dir);
  1482 			FiosBrowseTo(&o_dir);
  1483 			SetWindowDirty(w);
  1483 			w->SetDirty();
  1484 			BuildFileList();
  1484 			BuildFileList();
  1485 			break;
  1485 			break;
  1486 
  1486 
  1487 		case 7: { /* Click the listbox */
  1487 		case 7: { /* Click the listbox */
  1488 			int y = (e->we.click.pt.y - w->widget[e->we.click.widget].top - 1) / 10;
  1488 			int y = (e->we.click.pt.y - w->widget[e->we.click.widget].top - 1) / 10;
  1500 
  1500 
  1501 					SetFiosType(file->type);
  1501 					SetFiosType(file->type);
  1502 					ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
  1502 					ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
  1503 					ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title));
  1503 					ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title));
  1504 
  1504 
  1505 					DeleteWindow(w);
  1505 					w->Close();
  1506 				} else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
  1506 				} else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
  1507 					SetFiosType(file->type);
  1507 					SetFiosType(file->type);
  1508 					ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
  1508 					ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
  1509 					ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title));
  1509 					ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title));
  1510 
  1510 
  1511 					DeleteWindow(w);
  1511 					w->Close();
  1512 					ShowHeightmapLoad();
  1512 					ShowHeightmapLoad();
  1513 				} else {
  1513 				} else {
  1514 					// SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox
  1514 					// SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox
  1515 					ttd_strlcpy(WP(w, querystr_d).text.buf, file->title, WP(w, querystr_d).text.maxlength);
  1515 					ttd_strlcpy(WP(w, querystr_d).text.buf, file->title, WP(w, querystr_d).text.maxlength);
  1516 					UpdateTextBufferSize(&WP(w, querystr_d).text);
  1516 					UpdateTextBufferSize(&WP(w, querystr_d).text);
  1517 					InvalidateWidget(w, 10);
  1517 					InvalidateWidget(w, 10);
  1518 				}
  1518 				}
  1519 			} else {
  1519 			} else {
  1520 				// Changed directory, need repaint.
  1520 				// Changed directory, need repaint.
  1521 				SetWindowDirty(w);
  1521 				w->SetDirty();
  1522 				BuildFileList();
  1522 				BuildFileList();
  1523 			}
  1523 			}
  1524 			break;
  1524 			break;
  1525 		}
  1525 		}
  1526 
  1526 
  1533 			HandleEditBox(w, &WP(w, querystr_d), 10);
  1533 			HandleEditBox(w, &WP(w, querystr_d), 10);
  1534 		}
  1534 		}
  1535 		break;
  1535 		break;
  1536 	case WE_KEYPRESS:
  1536 	case WE_KEYPRESS:
  1537 		if (e->we.keypress.keycode == WKC_ESC) {
  1537 		if (e->we.keypress.keycode == WKC_ESC) {
  1538 			DeleteWindow(w);
  1538 			w->Close();
  1539 			return;
  1539 			return;
  1540 		}
  1540 		}
  1541 
  1541 
  1542 		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
  1542 		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
  1543 			if (HandleEditBoxKey(w, &WP(w, querystr_d), 10, e) == 1) /* Press Enter */
  1543 			if (HandleEditBoxKey(w, &WP(w, querystr_d), 10, e) == 1) /* Press Enter */
  1544 					HandleButtonClick(w, 12);
  1544 					w->HandleButtonClick(12);
  1545 		}
  1545 		}
  1546 		break;
  1546 		break;
  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  */
  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 			SetWindowDirty(w);
  1562 			w->SetDirty();
  1563 		} else if (IsWindowWidgetLowered(w, 12)) { /* Save button clicked */
  1563 		} else if (IsWindowWidgetLowered(w, 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) */
  1661 	ResetObjectToPlace();
  1661 	ResetObjectToPlace();
  1662 }
  1662 }
  1663 
  1663 
  1664 void RedrawAutosave(void)
  1664 void RedrawAutosave(void)
  1665 {
  1665 {
  1666 	SetWindowDirty(FindWindowById(WC_STATUS_BAR, 0));
  1666 	Window::SetDirtyById(WC_STATUS_BAR, 0);
  1667 }
  1667 }
  1668 
  1668 
  1669 void SetFiosType(const byte fiostype)
  1669 void SetFiosType(const byte fiostype)
  1670 {
  1670 {
  1671 	switch (fiostype) {
  1671 	switch (fiostype) {
  1737 
  1737 
  1738 	if ((ymd.year == MIN_YEAR && p2 == -1) || (ymd.year == MAX_YEAR && p2 == 1)) return _cur_year;
  1738 	if ((ymd.year == MIN_YEAR && p2 == -1) || (ymd.year == MAX_YEAR && p2 == 1)) return _cur_year;
  1739 
  1739 
  1740 	SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day));
  1740 	SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day));
  1741 	EnginesMonthlyLoop();
  1741 	EnginesMonthlyLoop();
  1742 	SetWindowDirty(FindWindowById(WC_STATUS_BAR, 0));
  1742 	Window::SetDirtyById(WC_STATUS_BAR, 0);
  1743 	return _cur_year;
  1743 	return _cur_year;
  1744 }
  1744 }
  1745 
  1745 
  1746 typedef int32 CheckButtonClick(int32, int32);
  1746 typedef int32 CheckButtonClick(int32, int32);
  1747 
  1747 
  1894 			} break;
  1894 			} break;
  1895 			}
  1895 			}
  1896 
  1896 
  1897 			if (value != oldvalue) {
  1897 			if (value != oldvalue) {
  1898 				WriteValue(ce->variable, ce->type, (int64)value);
  1898 				WriteValue(ce->variable, ce->type, (int64)value);
  1899 				SetWindowDirty(w);
  1899 				w->SetDirty();
  1900 			}
  1900 			}
  1901 
  1901 
  1902 			w->flags4 |= 5 << WF_TIMEOUT_SHL;
  1902 			w->flags4 |= 5 << WF_TIMEOUT_SHL;
  1903 
  1903 
  1904 			SetWindowDirty(w);
  1904 			w->SetDirty();
  1905 		}
  1905 		}
  1906 		break;
  1906 		break;
  1907 	case WE_TIMEOUT:
  1907 	case WE_TIMEOUT:
  1908 		WP(w,def_d).data_1 = 0;
  1908 		WP(w,def_d).data_1 = 0;
  1909 		SetWindowDirty(w);
  1909 		w->SetDirty();
  1910 		break;
  1910 		break;
  1911 	}
  1911 	}
  1912 }
  1912 }
  1913 
  1913 
  1914 static const WindowDesc _cheats_desc = {
  1914 static const WindowDesc _cheats_desc = {