48 if (_game_mode == GM_MENU)
return;
52 if (!c->error.has_value() || (c->error->severity != STR_NEWGRF_ERROR_MSG_FATAL && c->error->severity != STR_NEWGRF_ERROR_MSG_ERROR))
continue;
55 SetDParam (1, c->error->message != STR_NULL ? c->error->message : STR_JUST_RAW_STRING);
59 for (uint i = 0; i < c->error->param_value.size(); i++) {
60 SetDParam(5 + i, c->error->param_value[i]);
62 if (c->error->severity == STR_NEWGRF_ERROR_MSG_FATAL) {
71static void ShowNewGRFInfo(
const GRFConfig *c,
const Rect &r,
bool show_params)
74 if (c->
error.has_value()) {
78 for (uint i = 0; i < c->
error->param_value.size(); i++) {
111 if (!c->
param.empty()) {
115 SetDParam(0, STR_NEWGRF_SETTINGS_PARAMETER_NONE);
226 d.width += padding.width;
227 d.height += padding.height;
244 if (!
par_info.has_value())
continue;
246 if (desc ==
nullptr)
continue;
271 if (desc ==
nullptr)
return;
302 if (it !=
par_info.value_names.end()) {
304 if (label !=
nullptr) {
312 if (name !=
nullptr) {
327 if (this->closing_dropdown) {
328 this->closing_dropdown =
false;
329 this->clicked_dropdown =
false;
338 if (this->editable && !this->action14present && !this->grf_config->
param.empty()) {
339 this->grf_config->
param.pop_back();
348 this->grf_config->
param.emplace_back(0);
356 if (!this->editable)
break;
358 if (num >= this->vscroll->
GetCount())
break;
360 if (this->clicked_row != num) {
363 this->clicked_row = num;
364 this->clicked_dropdown =
false;
368 int x =
pt.x - r.left;
376 if (this->clicked_dropdown) {
379 this->clicked_dropdown =
false;
380 this->closing_dropdown =
false;
382 int rel_y = (
pt.y - r.top) % this->line_height;
391 if (
pt.y >= wi_rect.top &&
pt.y <= wi_rect.bottom) {
392 this->clicked_dropdown =
true;
393 this->closing_dropdown =
false;
411 this->clicked_increase =
true;
415 this->clicked_increase =
false;
421 this->clicked_button = num;
434 if (!this->editable)
break;
448 if (!str.has_value() || str->empty())
return;
458 assert(this->clicked_dropdown);
471 assert(this->clicked_dropdown);
472 this->closing_dropdown =
true;
489 if (!this->action14present) {
495 if (this->clicked_row !=
INT32_MAX && this->clicked_row >= this->vscroll->
GetCount()) {
510static constexpr NWidgetPart _nested_newgrf_parameter_widgets[] = {
521 NWidget(
WWT_TEXT, COLOUR_MAUVE,
WID_NP_NUMPAR),
SetResize(1, 0),
SetFill(1, 0),
SetPadding(0, 0, 0, 4),
SetDataTip(STR_NEWGRF_PARAMETERS_NUM_PARAM, STR_NULL),
526 NWidget(
WWT_MATRIX, COLOUR_MAUVE,
WID_NP_BACKGROUND),
SetMinimalSize(188, 182),
SetResize(1, 1),
SetFill(1, 0),
SetMatrixDataTip(1, 0, STR_NULL),
SetScrollbar(
WID_NP_SCROLLBAR),
544 WDP_CENTER,
"settings_newgrf_config", 500, 208,
547 _nested_newgrf_parameter_widgets
550void OpenGRFParameterWindow(
bool is_baseset,
GRFConfig *c,
bool editable)
562 this->ConstructWindow();
583typedef std::map<uint32_t, const GRFConfig *>
GrfIdMap;
592 while (c !=
nullptr) {
607 static const uint EDITBOX_MAX_SIZE = 50;
611 static const std::initializer_list<GUIGRFConfigList::SortFunction * const>
sorter_funcs;
612 static const std::initializer_list<GUIGRFConfigList::FilterFunction * const>
filter_funcs;
638 this->avail_sel =
nullptr;
639 this->avail_pos = -1;
640 this->active_sel =
nullptr;
641 this->actives =
nullptr;
647 this->active_over = -1;
683 if (this->editable && this->modified && !this->execute && !_exit_game) {
708 GrfIdMap::const_iterator
iter =
grfid_map.find(a->ident.grfid);
725 while (*c !=
iter->second) c = &(*c)->
next;
727 d->next = (*c)->next;
728 if (
d->IsCompatible((*c)->version)) {
731 d->SetParameterDefaults();
733 if (this->active_sel == *c) {
736 this->active_sel =
nullptr;
751 size.height = std::max(size.height, padding.height + 6 *
resize.height);
759 size.height = std::max(size.height, padding.height + 8 *
resize.height);
780 d.width += padding.width;
789 size.width += padding.width;
790 size.height += padding.height;
806 if (this->preset == -1) {
829 pal = PALETTE_TO_RED;
832 pal = PALETTE_TO_GREEN;
835 pal = PALETTE_TO_BLUE;
840 if (pal != PALETTE_TO_RED) {
842 pal = PALETTE_TO_GREY;
844 pal = PALETTE_TO_ORANGE;
873 for (
const GRFConfig *c = this->actives; c !=
nullptr; c = c->
next, i++) {
875 const char *text = c->
GetName();
876 bool h = (this->active_sel == c);
881 }
else if (i == this->active_over) {
894 tr.top += step_height;
897 if (i == this->active_over && this->vscroll->
IsVisible(i)) {
912 for (
auto it = first; it !=
last; ++it) {
915 const char *text = c->
GetName();
919 tr.top += step_height;
933 if (selected ==
nullptr) selected = this->
avail_sel;
934 if (selected !=
nullptr) {
935 ShowNewGRFInfo(selected, r, this->show_params);
945 if (this->active_sel ==
nullptr && this->avail_sel ==
nullptr)
return;
956 list.push_back(MakeDropDownListStringItem(
STR_NONE, -1));
958 for (uint i = 0; i < this->grf_presets.size(); i++) {
959 list.push_back(MakeDropDownListStringItem(this->grf_presets[i], i));
968 const GRFConfig *c = (this->avail_sel ==
nullptr) ? this->active_sel : this->
avail_sel;
979 if (this->preset == -1)
return;
989 if (this->active_sel ==
nullptr || !this->editable)
break;
996 this->active_sel->
next = c;
1008 if (this->active_sel ==
nullptr || !this->editable)
break;
1013 if (c == this->active_sel) {
1032 for (c = this->actives; c !=
nullptr && i > 0; c = c->
next, i--) {}
1034 if (this->active_sel != c) {
1038 this->active_sel = c;
1039 this->avail_sel =
nullptr;
1040 this->avail_pos = -1;
1043 if (click_count == 1) {
1052 if (this->active_sel ==
nullptr || !this->editable)
break;
1064 if (c == this->active_sel) {
1073 this->active_sel =
newsel;
1075 this->avail_pos = -1;
1076 this->avail_sel =
nullptr;
1083 if (!this->editable || this->actives ==
nullptr)
break;
1093 this->active_sel =
nullptr;
1095 if (it != this->avails.end()) {
1097 this->avail_sel = *it;
1098 this->avail_pos = it - this->avails.begin();
1101 if (click_count == 1) {
1116 if (!this->editable)
break;
1117 if (this->execute) {
1135 if (this->active_sel ==
nullptr || !this->show_params || this->active_sel->
num_valid_params == 0)
break;
1137 OpenGRFParameterWindow(
false, this->active_sel, this->editable);
1143 if (this->active_sel !=
nullptr && this->editable) {
1171 this->avail_sel =
nullptr;
1172 this->avail_pos = -1;
1180 if (!this->editable)
return;
1183 this->preset = index;
1193 this->active_sel =
nullptr;
1199 if (!str.has_value())
return;
1205 for (uint i = 0; i < this->grf_presets.size(); i++) {
1206 if (this->grf_presets[i] == str) {
1222 for (
const GRFConfig *c = this->actives; c !=
nullptr; c = c->
next, i++) {}
1226 if (this->avail_pos >= 0) this->vscroll2->
ScrollTowards(this->avail_pos);
1244 for (
GRFConfig **l = &this->actives; *l !=
nullptr; l = &(*l)->
next) {
1253 (*l)->next = c->
next;
1255 if (this->active_sel == c) this->active_sel = *l;
1264 this->modified =
false;
1276 this->modified =
true;
1282 this->modified =
false;
1286 this->BuildAvailables();
1351 if (this->avail_pos >= 0) {
1352 this->active_sel =
nullptr;
1355 this->avail_sel = this->avails[this->
avail_pos];
1365 if (!this->editable)
return;
1377 if (!this->editable)
return;
1380 if (this->active_sel !=
nullptr) {
1404 }
else if (this->avail_sel !=
nullptr) {
1410 Point dummy = {-1, -1};
1416 if (this->active_over != -1) {
1419 this->active_over = -1;
1425 if (!this->editable)
return;
1427 if (widget ==
WID_NS_FILE_LIST && (this->active_sel !=
nullptr || this->avail_sel !=
nullptr)) {
1433 if (
to_pos != this->active_over) {
1434 this->active_over =
to_pos;
1438 this->active_over = -2;
1440 }
else if (this->active_over != -1) {
1442 this->active_over = -1;
1451 if (i != 0)
return i < 0;
1454 if (i != 0)
return i < 0;
1463 filter.
AddLine((*a)->GetName());
1464 filter.
AddLine((*a)->filename);
1465 filter.
AddLine((*a)->GetDescription());
1469 void BuildAvailables()
1473 this->avails.clear();
1478 if (found)
continue;
1481 this->avails.push_back(c);
1495 this->avails.push_back(c);
1500 this->avails.
Filter(this->string_filter);
1502 this->avails.
Sort();
1504 if (this->avail_sel !=
nullptr) {
1505 this->avail_pos =
find_index(this->avails, this->avail_sel);
1506 if (this->avail_pos == -1) {
1507 this->avail_sel =
nullptr;
1511 this->vscroll2->
SetCount(this->avails.size());
1521 if (this->avail_sel ==
nullptr || !this->editable ||
HasBit(this->avail_sel->
flags,
GCF_INVALID))
return false;
1529 for (list = &this->actives; *list !=
nullptr; list = &(*list)->
next,
ins_pos--) {
1531 if ((*list)->ident.grfid ==
this->avail_sel->ident.grfid) {
1551 int new_pos = this->avail_pos + 1;
1552 if (new_pos >= (
int)this->avails.size()) new_pos = this->avail_pos - 1;
1553 this->avail_pos = new_pos;
1554 if (new_pos >= 0) this->avail_sel = this->avails[new_pos];
1570 for (
const GRFConfig *c = list; c !=
nullptr; c = c->
next) {
1606 std::unique_ptr<NWidgetBase>
avs;
1607 std::unique_ptr<NWidgetBase>
acs;
1608 std::unique_ptr<NWidgetBase>
inf;
1626 this->avs->SetupSmallestSize(w);
1627 this->acs->SetupSmallestSize(w);
1628 this->inf->SetupSmallestSize(w);
1630 uint min_avs_width = this->avs->smallest_x + this->avs->padding.Horizontal();
1631 uint min_acs_width = this->acs->smallest_x + this->acs->padding.Horizontal();
1632 uint min_inf_width = this->inf->smallest_x + this->inf->padding.Horizontal();
1634 uint min_avs_height = this->avs->smallest_y + this->avs->padding.Vertical();
1635 uint min_acs_height = this->acs->smallest_y + this->acs->padding.Vertical();
1636 uint min_inf_height = this->inf->smallest_y + this->inf->padding.Vertical();
1643 this->
fill_x = std::lcm(this->avs->fill_x, this->acs->fill_x);
1644 if (this->inf->fill_x > 0 && (this->fill_x == 0 || this->fill_x > this->inf->fill_x)) this->
fill_x = this->inf->fill_x;
1646 this->
fill_y = this->avs->fill_y;
1647 if (this->acs->fill_y > 0 && (this->fill_y == 0 || this->fill_y > this->acs->fill_y)) this->
fill_y = this->acs->fill_y;
1648 this->
fill_y = std::lcm(this->
fill_y, this->inf->fill_y);
1651 this->
resize_x = std::lcm(this->avs->resize_x, this->acs->resize_x);
1652 if (this->inf->resize_x > 0 && (this->resize_x == 0 || this->resize_x > this->inf->resize_x)) this->
resize_x = this->inf->resize_x;
1654 this->
resize_y = this->avs->resize_y;
1655 if (this->acs->resize_y > 0 && (this->resize_y == 0 || this->resize_y > this->acs->resize_y)) this->
resize_y = this->acs->resize_y;
1666 uint min_avs_width = this->avs->smallest_x + this->avs->padding.Horizontal();
1667 uint min_acs_width = this->acs->smallest_x + this->acs->padding.Horizontal();
1668 uint min_inf_width = this->inf->smallest_x + this->inf->padding.Horizontal();
1670 uint min_list_width = std::max(min_avs_width, min_acs_width);
1671 uint avs_extra_width = min_list_width - min_avs_width;
1672 uint acs_extra_width = min_list_width - min_acs_width;
1680 uint extra_width, inf_width;
1681 if (use_three_columns) {
1682 extra_width = given_width - min_three_columns;
1685 extra_width = given_width - min_two_columns;
1688 inf_width =
ComputeMaxSize(this->inf->smallest_x, this->inf->smallest_x + inf_width, this->inf->GetHorizontalStepSize(sizing));
1689 extra_width -= inf_width - this->inf->smallest_x;
1691 uint inf_height =
ComputeMaxSize(this->inf->smallest_y, given_height, this->inf->GetVerticalStepSize(sizing));
1693 if (use_three_columns) {
1696 uint avs_width = std::min(avs_extra_width, extra_width);
1697 extra_width -= avs_width;
1698 extra_width -= std::min(acs_extra_width, extra_width);
1699 avs_width += extra_width / 2;
1701 avs_width =
ComputeMaxSize(this->avs->smallest_x, this->avs->smallest_x + avs_width, this->avs->GetHorizontalStepSize(sizing));
1703 uint acs_width = given_width -
1704 inf_width - this->inf->padding.Horizontal() -
1706 acs_width =
ComputeMaxSize(min_acs_width, acs_width, this->acs->GetHorizontalStepSize(sizing)) -
1707 this->acs->padding.Horizontal();
1710 uint avs_height =
ComputeMaxSize(this->avs->smallest_y, given_height, this->avs->resize_y);
1711 uint acs_height =
ComputeMaxSize(this->acs->smallest_y, given_height, this->acs->resize_y);
1715 x += this->inf->padding.left;
1716 this->inf->AssignSizePosition(sizing, x, y + this->inf->padding.top, inf_width, inf_height, rtl);
1719 x += this->avs->padding.left;
1720 this->avs->AssignSizePosition(sizing, x, y + this->avs->padding.top, avs_width, avs_height, rtl);
1724 x += this->acs->padding.left;
1725 this->acs->AssignSizePosition(sizing, x, y + this->acs->padding.top, acs_width, acs_height, rtl);
1729 x += this->avs->padding.left;
1730 this->avs->AssignSizePosition(sizing, x, y + this->avs->padding.top, avs_width, avs_height, rtl);
1732 x += this->inf->padding.left;
1733 this->inf->AssignSizePosition(sizing, x, y + this->inf->padding.top, inf_width, inf_height, rtl);
1738 uint avs_width =
ComputeMaxSize(this->avs->smallest_x, this->avs->smallest_x + avs_extra_width + extra_width,
1739 this->avs->GetHorizontalStepSize(sizing));
1740 uint acs_width =
ComputeMaxSize(this->acs->smallest_x, this->acs->smallest_x + acs_extra_width + extra_width,
1741 this->acs->GetHorizontalStepSize(sizing));
1744 uint min_acs_height = this->acs->smallest_y + this->acs->padding.Vertical();
1745 uint extra_height = given_height - min_acs_height - min_avs_height;
1748 uint avs_height =
ComputeMaxSize(this->avs->smallest_y, this->avs->smallest_y + extra_height / 2, this->avs->resize_y);
1749 if (this->editable) extra_height -= avs_height - this->avs->smallest_y;
1750 uint acs_height =
ComputeMaxSize(this->acs->smallest_y, this->acs->smallest_y + extra_height, this->acs->resize_y);
1754 x += this->inf->padding.left;
1755 this->inf->AssignSizePosition(sizing, x, y + this->inf->padding.top, inf_width, inf_height, rtl);
1758 this->acs->AssignSizePosition(sizing, x + this->acs->padding.left, y + this->acs->padding.top, acs_width, acs_height, rtl);
1759 if (this->editable) {
1760 this->avs->AssignSizePosition(sizing, x + this->avs->padding.left, y + given_height - avs_height - this->avs->padding.bottom, avs_width, avs_height, rtl);
1762 this->avs->AssignSizePosition(sizing, 0, 0, this->avs->smallest_x, this->avs->smallest_y, rtl);
1765 this->acs->AssignSizePosition(sizing, x + this->acs->padding.left, y + this->acs->padding.top, acs_width, acs_height, rtl);
1766 if (this->editable) {
1767 this->avs->AssignSizePosition(sizing, x + this->avs->padding.left, y + given_height - avs_height - this->avs->padding.bottom, avs_width, avs_height, rtl);
1769 this->avs->AssignSizePosition(sizing, 0, 0, this->avs->smallest_x, this->avs->smallest_y, rtl);
1771 uint dx = this->acs->current_x + this->acs->padding.Horizontal();
1772 if (this->editable) {
1773 dx = std::max(dx, this->avs->current_x + this->avs->padding.Horizontal());
1776 this->inf->AssignSizePosition(sizing, x, y + this->inf->padding.top, inf_width, inf_height, rtl);
1783 this->avs->FillWidgetLookup(widget_lookup);
1784 this->acs->FillWidgetLookup(widget_lookup);
1785 this->inf->FillWidgetLookup(widget_lookup);
1800 if (this->editable) this->avs->Draw(w);
1809static constexpr NWidgetPart _nested_newgrf_actives_widgets[] = {
1817 SetDataTip(STR_JUST_STRING1, STR_NEWGRF_SETTINGS_PRESET_LIST_TOOLTIP),
1821 SetDataTip(STR_NEWGRF_SETTINGS_PRESET_SAVE, STR_NEWGRF_SETTINGS_PRESET_SAVE_TOOLTIP),
1823 SetDataTip(STR_NEWGRF_SETTINGS_PRESET_DELETE, STR_NEWGRF_SETTINGS_PRESET_DELETE_TOOLTIP),
1842 SetDataTip(STR_NEWGRF_SETTINGS_REMOVE, STR_NEWGRF_SETTINGS_REMOVE_TOOLTIP),
1845 SetDataTip(STR_NEWGRF_SETTINGS_MOVEUP, STR_NEWGRF_SETTINGS_MOVEUP_TOOLTIP),
1847 SetDataTip(STR_NEWGRF_SETTINGS_MOVEDOWN, STR_NEWGRF_SETTINGS_MOVEDOWN_TOOLTIP),
1850 SetDataTip(STR_NEWGRF_SETTINGS_UPGRADE, STR_NEWGRF_SETTINGS_UPGRADE_TOOLTIP),
1855 SetDataTip(STR_NEWGRF_SETTINGS_RESCAN_FILES, STR_NEWGRF_SETTINGS_RESCAN_FILES_TOOLTIP),
1857 SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
1864static constexpr NWidgetPart _nested_newgrf_availables_widgets[] = {
1870 SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
1886 SetDataTip(STR_NEWGRF_SETTINGS_ADD, STR_NEWGRF_SETTINGS_ADD_FILE_TOOLTIP),
1889 SetDataTip(STR_NEWGRF_SETTINGS_RESCAN_FILES, STR_NEWGRF_SETTINGS_RESCAN_FILES_TOOLTIP),
1891 SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
1897static constexpr NWidgetPart _nested_newgrf_infopanel_widgets[] = {
1909 SetDataTip(STR_CONTENT_OPEN_URL, STR_CONTENT_OPEN_URL_TOOLTIP),
1911 SetDataTip(STR_TEXTFILE_VIEW_README, STR_TEXTFILE_VIEW_README_TOOLTIP),
1915 SetDataTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_TEXTFILE_VIEW_CHANGELOG_TOOLTIP),
1917 SetDataTip(STR_TEXTFILE_VIEW_LICENCE, STR_TEXTFILE_VIEW_LICENCE_TOOLTIP),
1926 SetDataTip(STR_NEWGRF_SETTINGS_SET_PARAMETERS, STR_NULL),
1928 SetDataTip(STR_NEWGRF_SETTINGS_TOGGLE_PALETTE, STR_NEWGRF_SETTINGS_TOGGLE_PALETTE_TOOLTIP),
1931 SetDataTip(STR_NEWGRF_SETTINGS_APPLY_CHANGES, STR_NULL),
1934 SetDataTip(STR_NEWGRF_SETTINGS_SHOW_PARAMETERS, STR_NULL),
1942 std::unique_ptr<NWidgetBase> avs =
MakeNWidgets(_nested_newgrf_availables_widgets,
nullptr);
1943 std::unique_ptr<NWidgetBase> acs =
MakeNWidgets(_nested_newgrf_actives_widgets,
nullptr);
1944 std::unique_ptr<NWidgetBase> inf =
MakeNWidgets(_nested_newgrf_infopanel_widgets,
nullptr);
1946 return std::make_unique<NWidgetNewGRFDisplay>(std::move(avs), std::move(acs), std::move(inf));
1950static constexpr NWidgetPart _nested_newgrf_widgets[] = {
1971 _nested_newgrf_widgets
1997 for (c = nw->
actives; c !=
nullptr && i > 0; c = c->
next, i--) {}
2022 new NewGRFWindow(_newgrf_desc, editable, show_params, exec_changes, config);
2040 NWidget(
WWT_EDITBOX, COLOUR_GREY,
WID_SVP_EDITBOX),
SetPadding(2, 2, 2, 2),
SetFill(1, 0),
SetResize(1, 0),
2041 SetDataTip(STR_SAVE_PRESET_TITLE, STR_SAVE_PRESET_EDITBOX_TOOLTIP),
2072 this->selected = -1;
2074 for (uint i = 0; i < this->presets.size(); i++) {
2090 this->vscroll->
SetCount(this->presets.size());
2105 for (uint i = 0; i < this->presets.size(); i++) {
2107 size.width = std::max(size.width,
d.width + padding.width);
2110 size.height =
ClampU((uint)this->presets.size(), 5, 20) *
resize.height + padding.height;
2128 for (
auto it = first; it !=
last; ++it) {
2129 int row =
static_cast<int>(std::distance(std::begin(this->presets), it));
2133 tr.top += step_height;
2145 if (it != this->presets.end()) {
2146 this->selected = it - this->presets.begin();
2147 this->presetname_editbox.text.
Assign(*it);
2268 if (name ==
nullptr) {
2271 this->last_name = name;
2273 this->scanned = num;
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
static uint32_t BSWAP32(uint32_t x)
Perform a 32 bits endianness bitswap on x.
List template of 'things' T to sort in a GUI.
bool Filter(FilterFunction *decide, F filter_data)
Filter the list.
void RebuildDone()
Notify the sortlist that the rebuild is done.
void SetFiltering(Filtering f)
Import filter conditions.
void SetListing(Listing l)
Import sort conditions.
void SetFilterState(bool state)
Enable or disable the filter.
void SetFilterFuncs(std::span< FilterFunction *const > n_funcs)
Hand the filter function pointers to the GUIList.
bool NeedRebuild() const
Check if a rebuild is needed.
void ForceRebuild()
Force that a rebuild is needed.
bool Sort(Comp compare)
Sort the list.
void SetSortFuncs(std::span< SortFunction *const > n_funcs)
Hand the sort function pointers to the GUIList.
void StartAction(GamelogActionType at)
Stores information about new action, but doesn't allocate it Action is allocated only when there is a...
void GRFUpdate(const GRFConfig *oldg, const GRFConfig *newg)
Compares two NewGRF lists and logs any change.
void StopAction()
Stops logging of any changes.
A timeout timer will fire once after the interval.
void Reset()
Reset the timer, so it will fire again after the timeout.
static const uint NETWORK_MAX_GRF_COUNT
Maximum number of GRFs that can be sent.
int find_index(Container const &container, typename Container::const_reference item)
Helper function to get the index of an item Consider using std::set, std::unordered_set or std::flat_...
void ShowDropDownList(Window *w, DropDownList &&list, int selected, WidgetID button, uint width, bool instant_close, bool persist)
Show a drop down list.
void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, WidgetID button, Rect wi_rect, Colours wi_colour, bool instant_close, bool persist)
Show a drop down list.
Functions related to the drop down widget.
Types related to the drop down widget.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
Functions related to errors.
void ShowErrorMessage(StringID summary_msg, int x, int y, CommandCost cc)
Display an error message in a window.
@ WL_ERROR
Errors (eg. saving/loading failed)
@ WL_CRITICAL
Critical errors, the MessageBox is shown in all cases.
@ WL_INFO
Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
@ NEWGRF_DIR
Subdirectory for all NewGRFs.
Declarations for savegames operations.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Gamelog _gamelog
Gamelog instance.
Functions to be called to log fundamental changes to the game.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
int DrawStringMultiLine(int left, int right, int top, int bottom, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Dimension GetScaledSpriteSize(SpriteID sprid)
Scale sprite size for GUI.
int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
@ SA_HOR_CENTER
Horizontally center the text.
@ FS_NORMAL
Index of the normal font in the font tables.
uint32_t PaletteID
The number of the palette.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
constexpr bool IsInsideBS(const T x, const size_t base, const size_t size)
Checks if a value is between a window started at some base point.
constexpr uint ClampU(const uint a, const uint min, const uint max)
Clamp an unsigned integer between an interval.
constexpr bool IsInsideMM(const T x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback, bool focus)
Show a confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre o...
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
bool _network_available
is network mode available?
Basic functions/variables used all over the place.
Part of the network protocol handling content distribution.
void ShowNetworkContentListWindow(ContentVector *cv=nullptr, ContentType type1=CONTENT_TYPE_END, ContentType type2=CONTENT_TYPE_END)
Show the content list window with a given set of content.
std::vector< ContentInfo * > ContentVector
Vector with content info.
Base for the NewGRF implementation.
void ReloadNewGRFData()
Reload all NewGRF files during a running game.
GRFConfig * _all_grfs
First item in list of all scanned NewGRFs.
std::string GRFBuildParamList(const GRFConfig *c)
Build a string containing space separated parameter values, and terminate.
void ClearGRFConfigList(GRFConfig **config)
Clear a GRF Config list, freeing all nodes.
GRFConfig * _grfconfig
First item in list of current GRF set up.
GRFConfig ** CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_only)
Copy a GRF Config list.
const GRFConfig * FindGRFConfig(uint32_t grfid, FindGRFConfigMode mode, const MD5Hash *md5sum, uint32_t desired_version)
Find a NewGRF in the scanned list.
void ResetGRFConfig(bool defaults)
Reset the current GRF Config to either blank or newgame settings.
@ GRFP_GRF_UNSET
The NewGRF provided no information.
@ GRFP_USE_WINDOWS
The palette state is set to use the Windows palette.
@ GRFP_BLT_32BPP
The NewGRF prefers a 32 bpp blitter.
@ GRFP_USE_MASK
Bitmask to get only the use palette use states.
@ GRFP_GRF_MASK
Bitmask to get only the NewGRF supplied information.
@ GCF_INVALID
GRF is unusable with this version of OpenTTD.
@ GCF_STATIC
GRF file is used statically (can be used in any MP game)
@ GCF_COMPATIBLE
GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches)
@ GCS_DISABLED
GRF file is disabled.
@ GCS_NOT_FOUND
GRF file was not found in the local cache.
@ GCS_ACTIVATED
GRF file has been activated.
@ PTYPE_UINT_ENUM
The parameter allows a range of numbers, each of which can have a special name.
@ PTYPE_BOOL
The parameter is either 0 or 1.
@ FGCM_NEWEST
Find newest Grf.
@ FGCM_NEWEST_VALID
Find newest Grf, ignoring Grfs with GCF_INVALID set.
@ FGCM_EXACT
Only find Grfs matching md5sum.
std::map< uint32_t, const GRFConfig * > GrfIdMap
Map of grfid to the grf config.
void UpdateNewGRFScanStatus(uint num, const char *name)
Update the NewGRF scan status.
static void FillGrfidMap(const GRFConfig *c, GrfIdMap *grfid_map)
Add all grf configs from c into the map.
static WindowDesc _newgrf_parameters_desc(WDP_CENTER, "settings_newgrf_config", 500, 208, WC_GRF_PARAMETERS, WC_NONE, 0, _nested_newgrf_parameter_widgets)
Window definition for the change grf parameters window.
static void NewGRFConfirmationCallback(Window *w, bool confirmed)
Callback function for the newgrf 'apply changes' confirmation window.
static void ShowSavePresetWindow(const char *initial_text)
Open the window for saving a preset.
static constexpr NWidgetPart _nested_scan_progress_widgets[]
Widgets for the progress window.
void ShowMissingContentWindow(const GRFConfig *list)
Show the content list window with all missing grfs from the given list.
static WindowDesc _scan_progress_desc(WDP_CENTER, nullptr, 0, 0, WC_MODAL_PROGRESS, WC_NONE, 0, _nested_scan_progress_widgets)
Description of the widgets and other settings of the window.
static constexpr NWidgetPart _nested_save_preset_widgets[]
Widget parts of the save preset window.
static WindowDesc _save_preset_desc(WDP_CENTER, "save_preset", 140, 110, WC_SAVE_PRESET, WC_GAME_OPTIONS, WDF_MODAL, _nested_save_preset_widgets)
Window description of the preset save window.
std::unique_ptr< NWidgetBase > NewGRFDisplay()
Construct nested container widget for managing the lists and the info panel of the NewGRF GUI.
void ShowNewGRFError()
Show the first NewGRF error we can find.
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config)
Setup the NewGRF gui.
const char * GetGRFStringFromGRFText(const GRFTextList &text_list)
Get a C-string from a GRFText-list.
Header of Action 04 "universal holder" structure and functions.
bool RequestNewGRFScan(NewGRFScanCallback *callback)
Request a new NewGRF scan.
static const uint8_t PC_GREY
Grey palette colour.
static const uint8_t PC_DARK_GREY
Dark grey palette colour.
static const uint8_t PC_DARK_BLUE
Dark blue palette colour.
static const uint8_t PC_BLACK
Black palette colour.
Base for the GUIs that have an edit box in them.
A number of safeguards to prevent using unsafe methods.
GRFConfig * LoadGRFPresetFromConfig(const char *config_name)
Load a NewGRF configuration by preset-name.
StringList GetGRFPresetList()
Get the list of known NewGrf presets.
void SaveGRFPresetToConfig(const char *config_name, GRFConfig *config)
Save a NewGRF configuration with a preset name.
void DeleteGRFPresetFromConfig(const char *config_name)
Delete a NewGRF configuration by preset name.
ClientSettings _settings_client
The current settings for this game.
Functions related to setting/changing the settings.
void DrawArrowButtons(int x, int y, Colours button_colour, uint8_t state, bool clickable_left, bool clickable_right)
Draw [<][>] boxes.
void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable)
Draw a dropdown button.
void DrawBoolButton(int x, int y, bool state, bool clickable)
Draw a toggle button.
Functions for setting GUIs.
#define SETTING_BUTTON_WIDTH
Width of setting buttons.
#define SETTING_BUTTON_HEIGHT
Height of setting buttons.
Types related to global configuration settings.
Base types for having sorted lists in GUIs.
This file contains all sprite-related enums and defines.
static const CursorID SPR_CURSOR_MOUSE
Cursor sprite numbers.
Definition of base types and functions in a cross-platform compatible way.
std::string FormatArrayAsHex(std::span< const uint8_t > data)
Format a byte array into a continuous hex string.
int StrNaturalCompare(std::string_view s1, std::string_view s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
bool StrEmpty(const char *s)
Check if a string buffer is empty.
@ CS_NUMERAL
Only numeric ones.
std::vector< std::string > StringList
Type for a list of strings.
Searching and filtering using a stringterm.
void SetDParamMaxValue(size_t n, uint64_t max_value, uint min_count, FontSize size)
Set DParam n to some number that is suitable for string size computations.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
std::string GetString(StringID string)
Resolve the given StringID into a std::string with all the associated DParam lookups and formatting.
TextDirection _current_text_dir
Text direction of the currently selected language.
void SetDParamStr(size_t n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
void SetDParamMaxDigits(size_t n, uint count, FontSize size)
Set DParam n to some number that is suitable for string size computations.
Functions related to OTTD's strings.
@ TD_RTL
Text is written right-to-left by default.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
GUISettings gui
settings related to the GUI
Container for all important information about a piece of content.
uint32_t unique_id
Unique ID; either GRF ID or shortname.
MD5Hash md5sum
The MD5 checksum.
State state
Whether the content info is selected (for download)
std::string name
Name of the content.
@ DOES_NOT_EXIST
The content does not exist in the content system.
ContentType type
Type of content.
Dimensions (a width and height) of a rectangle in 2D.
Data structure describing what to show in the list (filter criteria).
Information about GRF, used in the game and (part of it) in savegames.
MD5Hash original_md5sum
MD5 checksum of original file if only a 'compatible' file was loaded.
void SetParameterDefaults()
Set the default value for all parameters as specified by action14.
const char * GetURL() const
Get the grf url.
uint8_t palette
GRFPalette, bitset.
uint8_t flags
NOSAVE: GCF_Flags, bitset.
const char * GetDescription() const
Get the grf info.
std::vector< std::optional< GRFParameterInfo > > param_info
NOSAVE: extra information about the parameters.
uint32_t version
NOSAVE: Version a NewGRF can set so only the newest NewGRF is shown.
std::vector< uint32_t > param
GRF parameters.
struct GRFConfig * next
NOSAVE: Next item in the linked list.
GRFStatus status
NOSAVE: GRFStatus, enum.
void SetValue(const GRFParameterInfo &info, uint32_t value)
Set the value of the given user-changeable parameter.
std::optional< GRFError > error
NOSAVE: Error/Warning during GRF loading (Action 0x0B)
std::optional< std::string > GetTextfile(TextfileType type) const
Search a textfile file next to this NewGRF.
uint8_t num_valid_params
NOSAVE: Number of valid parameters (action 0x14)
std::string filename
Filename - either with or without full path.
GRFIdentifier ident
grfid and md5sum to uniquely identify newgrfs
const char * GetName() const
Get the name of this grf.
uint32_t min_loadable_version
NOSAVE: Minimum compatible version a NewGRF can define.
uint32_t GetValue(const GRFParameterInfo &info) const
Get the value of the given user-changeable parameter.
bool HasGrfIdentifier(uint32_t grfid, const MD5Hash *md5sum) const
Does the identification match the provided values?
uint32_t grfid
GRF ID (defined by Action 0x08)
MD5Hash md5sum
MD5 checksum of file to distinguish files with the same GRF ID (eg. newer version of GRF)
Information about one grf parameter.
uint8_t param_nr
GRF parameter to store content in.
GRFParameterType type
The type of this parameter.
uint32_t last_newgrf_count
the numbers of NewGRFs we found during the last scan
bool newgrf_show_old_versions
whether to show old versions in the NewGRF list
bool scenario_developer
activate scenario developer: allow modifying NewGRFs in an existing game
bool newgrf_developer_tools
activate NewGRF developer tools and allow modifying NewGRFs in an existing game
Data structure describing how to show the list (what sort direction and criteria).
Window for setting the parameters of a NewGRF.
bool clicked_dropdown
Whether the dropdown is open.
void OnQueryTextFinished(std::optional< std::string > str) override
The query window opened from this window has closed.
void OnPaint() override
The window must be repainted.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
bool editable
Allow editing parameters.
bool HasParameterInfo(uint nr) const
Test if GRF Parameter Info exists for a given parameter index.
static GRFParameterInfo dummy_parameter_info
Dummy info in case a newgrf didn't provide info about some parameter.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
TimeoutTimer< TimerWindow > unclick_timeout
When reset, unclick the button after a small timeout.
bool action14present
True if action14 information is present.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
int line_height
Height of a row in the matrix widget.
bool clicked_increase
True if the increase button was clicked, false for the decrease button.
void OnDropdownSelect(WidgetID widget, int index) override
A dropdown option associated to this window has been selected.
void SetStringParameters(WidgetID widget) const override
Initialize string parameters for a widget.
int32_t clicked_row
The selected parameter, or INT_MAX when none is selected.
bool closing_dropdown
True, if the dropdown list is currently closing.
GRFConfig * grf_config
Set the parameters of this GRFConfig.
void OnDropdownClose(Point, WidgetID widget, int, bool) override
A dropdown window associated to this window has been closed.
int32_t clicked_button
The row in which a button was clicked or INT_MAX when none is selected.
static GRFParameterInfo & GetDummyParameterInfo(uint nr)
Get a dummy parameter-info object with default information.
GRFParameterInfo & GetParameterInfo(uint nr) const
Get GRF Parameter Info exists for a given parameter index.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
void OnResize() override
Called after the window got resized.
Callback for NewGRF scanning.
Window for displaying the textfile of a NewGRF.
const GRFConfig * grf_config
View the textfile of this GRFConfig.
void SetStringParameters(WidgetID widget) const override
Initialize string parameters for a widget.
Window for showing NewGRF files.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
bool editable
Is the window editable?
void OnEditboxChanged(WidgetID widget) override
The text in an editbox has been edited.
bool CanUpgradeCurrent()
Test whether the currently active set of NewGRFs can be upgraded with the available NewGRFs.
GRFConfig * active_sel
Selected active grf item.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
bool show_params
Are the grf-parameters shown in the info-panel?
void UpgradeCurrent()
Upgrade the currently active set of NewGRFs.
void OnResize() override
Called after the window got resized.
bool AddGRFToActive(int ins_pos=-1)
Insert a GRF into the active list.
int avail_pos
Index of avail_sel if existing, else -1.
int active_over
Active GRF item over which another one is dragged, -1 if none.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
void OnMouseDrag(Point pt, WidgetID widget) override
An 'object' is being dragged at the provided position, highlight the target if possible.
bool modified
The list of active NewGRFs has been modified since the last time they got saved.
bool execute
On pressing 'apply changes' are grf changes applied immediately, or only list is updated.
void OnDropdownSelect(WidgetID widget, int index) override
A dropdown option associated to this window has been selected.
EventState OnKeyPress(char32_t key, uint16_t keycode) override
A key has been pressed.
int preset
Selected preset or -1 if none selected.
GRFConfig ** orig_list
List active grfs in the game. Used as initial value, may be updated by the window.
StringList grf_presets
List of known NewGRF presets.
void SetStringParameters(WidgetID widget) const override
Initialize string parameters for a widget.
const GRFConfig * avail_sel
Currently selected available grf. nullptr is none is selected.
void UpdateScrollBars()
Updates the scroll bars for the active and inactive NewGRF lists.
QueryString filter_editbox
Filter editbox;.
static bool TagNameFilter(const GRFConfig *const *a, StringFilter &filter)
Filter grfs by tags/name.
GRFConfig * actives
Temporary active grf list to which changes are made.
void OnDragDrop(Point pt, WidgetID widget) override
A dragged 'object' has been released.
static Filtering last_filtering
Default filtering of GUIGRFConfigList.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
static const std::initializer_list< GUIGRFConfigList::SortFunction *const > sorter_funcs
Sort functions of the GUIGRFConfigList.
void OnQueryTextFinished(std::optional< std::string > str) override
The query window opened from this window has closed.
static const std::initializer_list< GUIGRFConfigList::FilterFunction *const > filter_funcs
Filter functions of the GUIGRFConfigList.
PaletteID GetPalette(const GRFConfig *c) const
Pick the palette for the sprite of the grf to display.
void OnNewGRFsScanned() override
Called whenever the NewGRF scan completed.
GUIGRFConfigList avails
Available (non-active) grfs.
StringFilter string_filter
Filter for available grf.
static Listing last_sorting
Default sorting of GUIGRFConfigList.
static bool NameSorter(const GRFConfig *const &a, const GRFConfig *const &b)
Sort grfs by name.
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
Coordinates of a point in 2D.
Data stored about a string that can be modified in the GUI.
int ok_button
Widget button of parent window to simulate when pressing OK in OSK.
int cancel_button
Widget button of parent window to simulate when pressing CANCEL in OSK.
static const int ACTION_CLEAR
Clear editbox.
constexpr uint Horizontal() const
Get total horizontal padding of RectPadding.
constexpr uint Vertical() const
Get total vertical padding of RectPadding.
Specification of a rectangle with absolute coordinates of all edges.
int Width() const
Get width of Rect.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Rect Indent(int indent, bool end) const
Copy Rect and indent it from its position.
Class for the save preset window.
QueryString presetname_editbox
Edit box of the save preset.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
void OnResize() override
Called after the window got resized.
SavePresetWindow(const char *initial_text)
Constructor of the save preset window.
int selected
Selected entry in the preset list, or -1 if none selected.
Scrollbar * vscroll
Pointer to the scrollbar widget.
StringList presets
Available presets.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Window for showing the progress of NewGRF scanning.
std::string last_name
The name of the last 'seen' NewGRF.
void UpdateNewGRFScanStatus(uint num, const char *name)
Update the NewGRF scan status.
int scanned
The number of NewGRFs that we have seen.
ScanProgressWindow()
Create the window.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
bool IsEmpty() const
Check whether any filter words were entered.
void SetFilterTerm(const char *str)
Set the term to filter on.
void ResetState()
Reset the matching state to process a new item.
void AddLine(const char *str)
Pass another text line from the current item to the filter.
bool GetState() const
Get the matching state of the current item.
void Assign(StringID string)
Render a string into the textbuffer.
char *const buf
buffer in which text is saved
Window for displaying a textfile.
TextfileType file_type
Type of textfile to view.
virtual void LoadTextfile(const std::string &textfile, Subdirectory dir)
Loads the textfile text from file and setup lines.
High level window description.
Data structure for an opened window.
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
std::map< WidgetID, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
void DrawWidgets() const
Paint all widgets of a window.
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
void CloseChildWindows(WindowClass wc=WC_INVALID) const
Close all children a window might have in a head-recursive manner.
ResizeInfo resize
Resize information.
void DisableWidget(WidgetID widget_index)
Sets a widget to disabled.
void SetWidgetsDisabledState(bool disab_stat, Args... widgets)
Sets the enabled/disabled status of a list of widgets.
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
virtual void OnQueryTextFinished(std::optional< std::string > str)
The query window opened from this window has closed.
bool SetFocusedWidget(WidgetID widget_index)
Set focus within this window to the given widget.
int top
y position of top edge of the window
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
int width
width of the window (number of pixels to the right in x direction)
@ CONTENT_TYPE_NEWGRF
The content consists of a NewGRF.
GUI functions related to textfiles.
TextfileType
Additional text files accompanying Tar archives.
@ TFT_LICENSE
Content license.
@ TFT_README
Content readme.
@ TFT_CHANGELOG
Content changelog.
Functions related to tile highlights.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
@ HT_DRAG
dragging items in the depot windows
Definition of Interval and OneShot timers.
Definition of the Window system.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Window * FindWindowByClass(WindowClass cls)
Find any window by its class.
void ReInitAllWindows(bool zoom_changed)
Re-initialize all windows.
void CloseWindowByClass(WindowClass cls, int data)
Close all windows of a given class.
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
Window functions not directly related to making/drawing windows.
@ FR_BORDERONLY
Draw border only, no background.
@ FR_LOWERED
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
@ WDF_MODAL
The window is a modal child of some other window, meaning the parent is 'inactive'.
@ WDP_CENTER
Center the window.
@ WN_GAME_OPTIONS_NEWGRF_STATE
NewGRF settings.
EventState
State of handling an event.
@ ES_HANDLED
The passed event is handled.
@ ES_NOT_HANDLED
The passed event is not handled.
@ WC_BUILD_OBJECT
Build object; Window numbers:
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ WC_SAVE_PRESET
Save preset; Window numbers:
@ WC_GAME_OPTIONS
Game options window; Window numbers:
@ WC_TEXTFILE
textfile; Window numbers:
@ WC_DROPDOWN_MENU
Drop down menu; Window numbers:
@ WC_QUERY_STRING
Query string window; Window numbers:
@ WC_GRF_PARAMETERS
NewGRF parameters; Window numbers:
@ WC_MODAL_PROGRESS
Progress report of landscape generation; Window numbers:
@ GOID_NEWGRF_CURRENT_LOADED
The current list of active NewGRF has been loaded.
@ GOID_NEWGRF_RESCANNED
NewGRFs were just rescanned.
@ GOID_NEWGRF_CHANGES_APPLIED
The active NewGRF list changes have been applied.
@ GOID_NEWGRF_CHANGES_MADE
Changes have been made to a given NewGRF either through the palette or its parameters.
@ GOID_NEWGRF_LIST_EDITED
List of active NewGRFs is being edited.
Functions related to zooming.