OpenTTD Source: src/network/network_content_gui.cpp Source File

OpenTTD Source 15.3

network_content_gui.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#include "../stdafx.h"
11#include "../strings_func.h"
12#include "../gfx_func.h"
13#include "../window_func.h"
14#include "../error.h"
15#include "../ai/ai.hpp"
16#include "../game/game.hpp"
17#include "../base_media_base.h"
18#include "../base_media_graphics.h"
19#include "../base_media_music.h"
20#include "../base_media_sounds.h"
21#include "../openttd.h"
22#include "../sortlist_type.h"
23#include "../stringfilter_type.h"
24#include "../querystring_gui.h"
25#include "../core/geometry_func.hpp"
26#include "../textfile_gui.h"
27#include "../fios.h"
28#include "network_content_gui.h"
29
30
31#include "table/strings.h"
32#include "../table/sprites.h"
33
34#include "../safeguards.h"
35
36
38 static bool _accepted_external_search = false;
39
40
42 struct ContentTextfileWindow : public TextfileWindow {
43 const ContentInfo *ci = nullptr;
44
45 ContentTextfileWindow(Window *parent, TextfileType file_type, const ContentInfo *ci) : TextfileWindow(parent, file_type), ci(ci)
46 {
47 this->ConstructWindow();
48
49 auto textfile = this->ci->GetTextfile(file_type);
50 this->LoadTextfile(textfile.value(), GetContentInfoSubDir(this->ci->type));
51 }
52
53 StringID GetTypeString() const
54 {
55 switch (this->ci->type) {
56 case CONTENT_TYPE_NEWGRF: return STR_CONTENT_TYPE_NEWGRF;
57 case CONTENT_TYPE_BASE_GRAPHICS: return STR_CONTENT_TYPE_BASE_GRAPHICS;
58 case CONTENT_TYPE_BASE_SOUNDS: return STR_CONTENT_TYPE_BASE_SOUNDS;
59 case CONTENT_TYPE_BASE_MUSIC: return STR_CONTENT_TYPE_BASE_MUSIC;
60 case CONTENT_TYPE_AI: return STR_CONTENT_TYPE_AI;
61 case CONTENT_TYPE_AI_LIBRARY: return STR_CONTENT_TYPE_AI_LIBRARY;
62 case CONTENT_TYPE_GAME: return STR_CONTENT_TYPE_GAME_SCRIPT;
63 case CONTENT_TYPE_GAME_LIBRARY: return STR_CONTENT_TYPE_GS_LIBRARY;
64 case CONTENT_TYPE_SCENARIO: return STR_CONTENT_TYPE_SCENARIO;
65 case CONTENT_TYPE_HEIGHTMAP: return STR_CONTENT_TYPE_HEIGHTMAP;
66 default: NOT_REACHED();
67 }
68 }
69
70 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
71 {
72 if (widget == WID_TF_CAPTION) {
73 return GetString(stringid, this->GetTypeString(), this->ci->name);
74 }
75
76 return this->Window::GetWidgetString(widget, stringid);
77 }
78};
79
80static void ShowContentTextfileWindow(Window *parent, TextfileType file_type, const ContentInfo *ci)
81{
82 parent->CloseChildWindowById(WC_TEXTFILE, file_type);
83 new ContentTextfileWindow(parent, file_type, ci);
84}
85
87 static constexpr std::initializer_list<NWidgetPart> _nested_network_content_download_status_window_widgets = {
88 NWidget(WWT_CAPTION, COLOUR_GREY), SetStringTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
89 NWidget(WWT_PANEL, COLOUR_GREY),
90 NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
91 NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_BAR), SetFill(1, 0),
92 NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_TEXT), SetFill(1, 0), SetMinimalSize(350, 0),
93 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCDS_CANCELOK), SetStringTip(STR_BUTTON_CANCEL), SetFill(1, 0),
94 EndContainer(),
95 EndContainer(),
96};
97
99 static WindowDesc _network_content_download_status_window_desc(
100 WDP_CENTER, {}, 0, 0,
101 WC_NETWORK_STATUS_WINDOW, WC_NONE,
102 WindowDefaultFlag::Modal,
103 _nested_network_content_download_status_window_widgets
104);
105
106BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(WindowDesc &desc) : Window(desc)
107{
108 _network_content_client.AddCallback(this);
109 _network_content_client.DownloadSelectedContent(this->total_files, this->total_bytes);
110
111 this->InitNested(WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
112}
113
114 void BaseNetworkContentDownloadStatusWindow::Close([[maybe_unused]] int data)
115{
116 _network_content_client.RemoveCallback(this);
117 this->Window::Close();
118}
119
120 void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize)
121{
122 switch (widget) {
123 case WID_NCDS_PROGRESS_BAR: {
124 auto max_value = GetParamMaxDigits(8);
125 size = GetStringBoundingBox(GetString(STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, max_value, max_value, max_value));
126 /* We need some spacing for the 'border' */
127 size.height += WidgetDimensions::scaled.frametext.Horizontal();
128 size.width += WidgetDimensions::scaled.frametext.Vertical();
129 break;
130 }
131
132 case WID_NCDS_PROGRESS_TEXT:
133 size.height = GetCharacterHeight(FS_NORMAL) * 2 + WidgetDimensions::scaled.vsep_normal;
134 break;
135 }
136}
137
138 void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, WidgetID widget) const
139{
140 switch (widget) {
141 case WID_NCDS_PROGRESS_BAR: {
142 /* Draw the % complete with a bar and a text */
143 DrawFrameRect(r, COLOUR_GREY, {FrameFlag::BorderOnly, FrameFlag::Lowered});
144 Rect ir = r.Shrink(WidgetDimensions::scaled.bevel);
145 DrawFrameRect(ir.WithWidth((uint64_t)ir.Width() * this->downloaded_bytes / this->total_bytes, _current_text_dir == TD_RTL), COLOUR_MAUVE, {});
146 DrawString(ir.left, ir.right, CentreBounds(ir.top, ir.bottom, GetCharacterHeight(FS_NORMAL)),
147 GetString(STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, this->downloaded_bytes, this->total_bytes, this->downloaded_bytes * 100LL / this->total_bytes),
148 TC_FROMSTRING, SA_HOR_CENTER);
149 break;
150 }
151
152 case WID_NCDS_PROGRESS_TEXT:
153 if (this->downloaded_bytes == this->total_bytes) {
154 DrawStringMultiLine(r, STR_CONTENT_DOWNLOAD_COMPLETE, TC_FROMSTRING, SA_CENTER);
155 } else if (!this->name.empty()) {
156 DrawStringMultiLine(r,
157 GetString(STR_CONTENT_DOWNLOAD_FILE, this->name, this->downloaded_files, this->total_files),
158 TC_FROMSTRING, SA_CENTER);
159 } else {
160 DrawStringMultiLine(r, STR_CONTENT_DOWNLOAD_INITIALISE, TC_FROMSTRING, SA_CENTER);
161 }
162 break;
163 }
164}
165
166 void BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(const ContentInfo &ci, int bytes)
167{
168 if (ci.id != this->cur_id) {
169 this->name = ci.filename;
170 this->cur_id = ci.id;
171 this->downloaded_files++;
172 }
173
174 /* A negative value means we are resetting; for example, when retrying or using a fallback. */
175 if (bytes < 0) {
176 this->downloaded_bytes = 0;
177 } else {
178 this->downloaded_bytes += bytes;
179 }
180
181 this->SetDirty();
182}
183
184
186 struct NetworkContentDownloadStatusWindow : public BaseNetworkContentDownloadStatusWindow {
187private:
188 ContentTypes received_types{};
189
190public:
195 NetworkContentDownloadStatusWindow() : BaseNetworkContentDownloadStatusWindow(_network_content_download_status_window_desc)
196 {
197 this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
198 }
199
200 void Close([[maybe_unused]] int data = 0) override
201 {
202 TarScanner::Modes modes{};
203 for (auto ctype : this->received_types) {
204 switch (ctype) {
205 case CONTENT_TYPE_AI:
206 case CONTENT_TYPE_AI_LIBRARY:
207 /* AI::Rescan calls the scanner. */
208 break;
209 case CONTENT_TYPE_GAME:
210 case CONTENT_TYPE_GAME_LIBRARY:
211 /* Game::Rescan calls the scanner. */
212 break;
213
214 case CONTENT_TYPE_BASE_GRAPHICS:
215 case CONTENT_TYPE_BASE_SOUNDS:
216 case CONTENT_TYPE_BASE_MUSIC:
217 modes.Set(TarScanner::Mode::Baseset);
218 break;
219
220 case CONTENT_TYPE_NEWGRF:
221 /* ScanNewGRFFiles calls the scanner. */
222 break;
223
224 case CONTENT_TYPE_SCENARIO:
225 case CONTENT_TYPE_HEIGHTMAP:
226 modes.Set(TarScanner::Mode::Scenario);
227 break;
228
229 default:
230 break;
231 }
232 }
233
234 TarScanner::DoScan(modes);
235
236 /* Tell all the backends about what we've downloaded */
237 for (auto ctype : this->received_types) {
238 switch (ctype) {
239 case CONTENT_TYPE_AI:
240 case CONTENT_TYPE_AI_LIBRARY:
241 AI::Rescan();
242 break;
243
244 case CONTENT_TYPE_GAME:
245 case CONTENT_TYPE_GAME_LIBRARY:
246 Game::Rescan();
247 break;
248
249 case CONTENT_TYPE_BASE_GRAPHICS:
250 BaseGraphics::FindSets();
251 SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
252 break;
253
254 case CONTENT_TYPE_BASE_SOUNDS:
255 BaseSounds::FindSets();
256 SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
257 break;
258
259 case CONTENT_TYPE_BASE_MUSIC:
260 BaseMusic::FindSets();
261 SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
262 break;
263
264 case CONTENT_TYPE_NEWGRF:
265 RequestNewGRFScan();
266 break;
267
268 case CONTENT_TYPE_SCENARIO:
269 case CONTENT_TYPE_HEIGHTMAP:
270 ScanScenarios();
271 InvalidateWindowData(WC_SAVELOAD, 0, 0);
272 break;
273
274 default:
275 break;
276 }
277 }
278
279 /* Always invalidate the download window; tell it we are going to be gone */
280 InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST, 2);
281
282 this->BaseNetworkContentDownloadStatusWindow::Close();
283 }
284
285 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
286 {
287 if (widget == WID_NCDS_CANCELOK) {
288 if (this->downloaded_bytes != this->total_bytes) {
289 _network_content_client.Cancel();
290 this->Close();
291 } else {
292 /* If downloading succeeded, close the online content window. This will close
293 * the current window as well. */
294 CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
295 }
296 }
297 }
298
299 void OnDownloadProgress(const ContentInfo &ci, int bytes) override
300 {
301 BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(ci, bytes);
302 this->received_types.Set(ci.type);
303
304 /* When downloading is finished change cancel in ok */
305 if (this->downloaded_bytes == this->total_bytes) {
306 this->GetWidget<NWidgetCore>(WID_NCDS_CANCELOK)->SetString(STR_BUTTON_OK);
307 }
308 }
309};
310
312 struct ContentListFilterData {
313 StringFilter string_filter;
314 ContentTypes types;
315};
316
318 enum ContentListFilterCriteria : uint8_t {
319 CONTENT_FILTER_TEXT = 0,
320 CONTENT_FILTER_TYPE_OR_SELECTED,
321};
322
324 class NetworkContentListWindow : public Window, ContentCallback {
326 typedef GUIList<const ContentInfo *, std::nullptr_t, ContentListFilterData &> GUIContentList;
327
328 static const uint EDITBOX_MAX_SIZE = 50;
329
330 static Listing last_sorting;
331 static Filtering last_filtering;
332 static const std::initializer_list<GUIContentList::SortFunction * const> sorter_funcs;
333 static const std::initializer_list<GUIContentList::FilterFunction * const> filter_funcs;
334 GUIContentList content{};
335 bool auto_select = false;
336 ContentListFilterData filter_data{};
337 QueryString filter_editbox;
338 Dimension checkbox_size{};
339
340 const ContentInfo *selected = nullptr;
341 int list_pos = 0;
342 uint filesize_sum = 0;
343 Scrollbar *vscroll = nullptr;
344
345 static std::string content_type_strs[CONTENT_TYPE_END];
346
348 void OpenExternalSearch()
349 {
350 std::string url;
351 url.reserve(1024);
352
353 url += "https://grfsearch.openttd.org/?";
354
355 if (this->auto_select) {
356 url += "do=searchgrfid&q=";
357
358 bool first = true;
359 for (const ContentInfo *ci : this->content) {
360 if (ci->state != ContentInfo::State::DoesNotExist) continue;
361
362 if (!first) url.push_back(',');
363 first = false;
364
365 format_append(url, "{:08X}:{}", ci->unique_id, FormatArrayAsHex(ci->md5sum));
366 }
367 } else {
368 url += "do=searchtext&q=";
369
370 /* Escape search term */
371 for (char search : this->filter_editbox.text.GetText()) {
372 /* Remove quotes */
373 if (search == '\'' || search == '"') continue;
374
375 /* Escape special chars, such as &%,= */
376 if (static_cast<unsigned char>(search) < 0x30) {
377 format_append(url, "%{:02X}", search);
378 } else {
379 url.push_back(search);
380 }
381 }
382 }
383
384 OpenBrowser(url);
385 }
386
390 static void ExternalSearchDisclaimerCallback(Window *w, bool accepted)
391 {
392 if (accepted) {
393 _accepted_external_search = true;
394 ((NetworkContentListWindow*)w)->OpenExternalSearch();
395 }
396 }
397
402 void BuildContentList()
403 {
404 if (!this->content.NeedRebuild()) return;
405
406 /* Create temporary array of games to use for listing */
407 this->content.clear();
408
409 bool all_available = true;
410
411 for (const ContentInfo &ci : _network_content_client.Info()) {
412 if (ci.state == ContentInfo::State::DoesNotExist) all_available = false;
413 this->content.push_back(&ci);
414 }
415
416 this->SetWidgetDisabledState(WID_NCL_SEARCH_EXTERNAL, this->auto_select && all_available);
417
418 this->FilterContentList();
419 this->content.RebuildDone();
420 this->SortContentList();
421
422 this->vscroll->SetCount(this->content.size()); // Update the scrollbar
423 this->ScrollToSelected();
424 }
425
427 static bool NameSorter(const ContentInfo * const &a, const ContentInfo * const &b)
428 {
429 int r = StrNaturalCompare(a->name, b->name, true); // Sort by name (natural sorting).
430 if (r == 0) r = StrNaturalCompare(a->version, b->version, true);
431 return r < 0;
432 }
433
435 static bool TypeSorter(const ContentInfo * const &a, const ContentInfo * const &b)
436 {
437 int r = 0;
438 if (a->type != b->type) {
439 r = StrNaturalCompare(content_type_strs[a->type], content_type_strs[b->type]);
440 }
441 if (r == 0) return NameSorter(a, b);
442 return r < 0;
443 }
444
446 static bool StateSorter(const ContentInfo * const &a, const ContentInfo * const &b)
447 {
448 int r = to_underlying(a->state) - to_underlying(b->state);
449 if (r == 0) return TypeSorter(a, b);
450 return r < 0;
451 }
452
454 void SortContentList()
455 {
456 if (!this->content.Sort()) return;
457
458 int idx = find_index(this->content, this->selected);
459 if (idx >= 0) this->list_pos = idx;
460 }
461
463 static bool TagNameFilter(const ContentInfo * const *a, ContentListFilterData &filter)
464 {
465 if ((*a)->state == ContentInfo::State::Selected || (*a)->state == ContentInfo::State::Autoselected) return true;
466
467 filter.string_filter.ResetState();
468 for (auto &tag : (*a)->tags) filter.string_filter.AddLine(tag);
469
470 filter.string_filter.AddLine((*a)->name);
471 return filter.string_filter.GetState();
472 }
473
475 static bool TypeOrSelectedFilter(const ContentInfo * const *a, ContentListFilterData &filter)
476 {
477 if (filter.types.None()) return true;
478 if (filter.types.Test((*a)->type)) return true;
479 return ((*a)->state == ContentInfo::State::Selected || (*a)->state == ContentInfo::State::Autoselected);
480 }
481
483 void FilterContentList()
484 {
485 /* Apply filters. */
486 bool changed = false;
487 if (!this->filter_data.string_filter.IsEmpty()) {
488 this->content.SetFilterType(CONTENT_FILTER_TEXT);
489 changed |= this->content.Filter(this->filter_data);
490 }
491 if (this->filter_data.types.Any()) {
492 this->content.SetFilterType(CONTENT_FILTER_TYPE_OR_SELECTED);
493 changed |= this->content.Filter(this->filter_data);
494 }
495 if (!changed) return;
496
497 /* update list position */
498 int idx = find_index(this->content, this->selected);
499 if (idx >= 0) {
500 this->list_pos = idx;
501 return;
502 }
503
504 /* previously selected item not in list anymore */
505 this->selected = nullptr;
506 this->list_pos = 0;
507 }
508
513 bool UpdateFilterState()
514 {
515 Filtering old_params = this->content.GetFiltering();
516 bool new_state = !this->filter_data.string_filter.IsEmpty() || this->filter_data.types.Any();
517 if (new_state != old_params.state) {
518 this->content.SetFilterState(new_state);
519 }
520 return new_state != old_params.state;
521 }
522
524 void ScrollToSelected()
525 {
526 if (this->selected == nullptr) return;
527
528 this->vscroll->ScrollTowards(this->list_pos);
529 }
530
531 friend void BuildContentTypeStringList();
532public:
542 NetworkContentListWindow(WindowDesc &desc, bool select_all, ContentTypes types) :
543 Window(desc),
544 auto_select(select_all),
545 filter_editbox(EDITBOX_MAX_SIZE)
546 {
547 this->CreateNestedTree();
548 this->vscroll = this->GetScrollbar(WID_NCL_SCROLLBAR);
549 this->FinishInitNested(WN_NETWORK_WINDOW_CONTENT_LIST);
550
551 this->GetWidget<NWidgetStacked>(WID_NCL_SEL_ALL_UPDATE)->SetDisplayedPlane(select_all);
552
553 this->querystrings[WID_NCL_FILTER] = &this->filter_editbox;
554 this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR;
555 this->SetFocusedWidget(WID_NCL_FILTER);
556 this->SetWidgetDisabledState(WID_NCL_SEARCH_EXTERNAL, this->auto_select);
557 this->filter_data.types = types;
558
559 _network_content_client.AddCallback(this);
560 this->content.SetListing(this->last_sorting);
561 this->content.SetFiltering(this->last_filtering);
562 this->content.SetSortFuncs(this->sorter_funcs);
563 this->content.SetFilterFuncs(this->filter_funcs);
564 this->UpdateFilterState();
565 this->content.ForceRebuild();
566 this->FilterContentList();
567 this->SortContentList();
568 this->InvalidateData();
569 }
570
571 void Close([[maybe_unused]] int data = 0) override
572 {
573 _network_content_client.RemoveCallback(this);
574 this->Window::Close();
575 }
576
577 void OnInit() override
578 {
579 this->checkbox_size = maxdim(maxdim(GetScaledSpriteSize(SPR_BOX_EMPTY), GetScaledSpriteSize(SPR_BOX_CHECKED)), GetScaledSpriteSize(SPR_BLOT));
580 }
581
582 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
583 {
584 switch (widget) {
585 case WID_NCL_CHECKBOX:
586 size.width = std::max<uint>(this->checkbox_size.width, Window::SortButtonWidth()) + padding.width;
587 break;
588
589 case WID_NCL_TYPE: {
590 /* Width must be enough for header label and sort buttons.*/
591 size.width += Window::SortButtonWidth() * 2;
592 /* And also enough for the width of each type of content. */
593 Dimension d = size;
594 for (int i = CONTENT_TYPE_BEGIN; i < CONTENT_TYPE_END; i++) {
595 d = maxdim(d, GetStringBoundingBox(STR_CONTENT_TYPE_BASE_GRAPHICS + i - CONTENT_TYPE_BASE_GRAPHICS));
596 }
597 size.width = std::max(size.width, d.width + padding.width);
598 break;
599 }
600
601 case WID_NCL_NAME:
602 size.width += Window::SortButtonWidth() * 2;
603 break;
604
605 case WID_NCL_MATRIX:
606 fill.height = resize.height = std::max<uint>(std::max<uint>(this->checkbox_size.height, GetCharacterHeight(FS_NORMAL)), GetCharacterHeight(FS_SMALL)) + padding.height;
607 size.height = 10 * resize.height;
608 break;
609 }
610 }
611
612
613 void DrawWidget(const Rect &r, WidgetID widget) const override
614 {
615 switch (widget) {
616 case WID_NCL_DETAILS:
617 this->DrawDetails(r);
618 break;
619
620 case WID_NCL_MATRIX:
621 this->DrawMatrix(r);
622 break;
623 }
624 }
625
626 void OnPaint() override
627 {
628 const SortButtonState arrow = this->content.IsDescSortOrder() ? SBS_DOWN : SBS_UP;
629
630 if (this->content.NeedRebuild()) {
631 this->BuildContentList();
632 }
633
634 this->DrawWidgets();
635
636 switch (this->content.SortType()) {
637 case WID_NCL_CHECKBOX - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_CHECKBOX, arrow); break;
638 case WID_NCL_TYPE - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_TYPE, arrow); break;
639 case WID_NCL_NAME - WID_NCL_CHECKBOX: this->DrawSortButtonState(WID_NCL_NAME, arrow); break;
640 }
641 }
642
647 void DrawMatrix(const Rect &r) const
648 {
649 bool rtl = _current_text_dir == TD_RTL;
650 const Rect checkbox = this->GetWidget<NWidgetBase>(WID_NCL_CHECKBOX)->GetCurrentRect();
651 const Rect name = this->GetWidget<NWidgetBase>(WID_NCL_NAME)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect);
652 const Rect type = this->GetWidget<NWidgetBase>(WID_NCL_TYPE)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect);
653
654 /* Fill the matrix with the information */
655 const uint step_height = this->GetWidget<NWidgetBase>(WID_NCL_MATRIX)->resize_y;
656 const int text_y_offset = WidgetDimensions::scaled.matrix.top + (step_height - WidgetDimensions::scaled.matrix.Vertical() - GetCharacterHeight(FS_NORMAL)) / 2;
657 const int version_y_offset = WidgetDimensions::scaled.matrix.top + (step_height - WidgetDimensions::scaled.matrix.Vertical() - GetCharacterHeight(FS_SMALL)) / 2;
658
659 Rect mr = r.WithHeight(step_height);
660 auto [first, last] = this->vscroll->GetVisibleRangeIterators(this->content);
661 for (auto iter = first; iter != last; iter++) {
662 const ContentInfo *ci = *iter;
663
664 if (ci == this->selected) GfxFillRect(mr.Shrink(WidgetDimensions::scaled.bevel), PC_GREY);
665
666 SpriteID sprite;
667 SpriteID pal = PAL_NONE;
668 switch (ci->state) {
669 case ContentInfo::State::Unselected: sprite = SPR_BOX_EMPTY; break;
670 case ContentInfo::State::Selected: sprite = SPR_BOX_CHECKED; break;
671 case ContentInfo::State::Autoselected: sprite = SPR_BOX_CHECKED; break;
672 case ContentInfo::State::AlreadyHere: sprite = SPR_BLOT; pal = PALETTE_TO_GREEN; break;
673 case ContentInfo::State::DoesNotExist: sprite = SPR_BLOT; pal = PALETTE_TO_RED; break;
674 default: NOT_REACHED();
675 }
676 DrawSpriteIgnorePadding(sprite, pal, checkbox.WithY(mr), SA_CENTER);
677
678 StringID str = STR_CONTENT_TYPE_BASE_GRAPHICS + ci->type - CONTENT_TYPE_BASE_GRAPHICS;
679 DrawString(type.left, type.right, mr.top + text_y_offset, str, TC_BLACK, SA_HOR_CENTER);
680
681 int x = DrawString(name.left, name.right, mr.top + version_y_offset, ci->version, TC_BLACK, SA_RIGHT, false, FS_SMALL);
682 x += rtl ? WidgetDimensions::scaled.hsep_wide : -WidgetDimensions::scaled.hsep_wide;
683
684 DrawString(rtl ? x : name.left, rtl ? name.right : x, mr.top + text_y_offset, ci->name, TC_BLACK);
685 mr = mr.Translate(0, step_height);
686 }
687 }
688
693 void DrawDetails(const Rect &r) const
694 {
695 /* Height for the title banner */
696 int HEADER_HEIGHT = 3 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.frametext.Vertical();
697
698 Rect hr = r.WithHeight(HEADER_HEIGHT).Shrink(WidgetDimensions::scaled.frametext);
699 Rect tr = r.Shrink(WidgetDimensions::scaled.frametext);
700 tr.top += HEADER_HEIGHT;
701
702 /* Create the nice darker rectangle at the details top */
703 GfxFillRect(r.WithHeight(HEADER_HEIGHT).Shrink(WidgetDimensions::scaled.bevel.left, WidgetDimensions::scaled.bevel.top, WidgetDimensions::scaled.bevel.right, 0), GetColourGradient(COLOUR_LIGHT_BLUE, SHADE_NORMAL));
704 DrawString(hr.left, hr.right, hr.top, STR_CONTENT_DETAIL_TITLE, TC_FROMSTRING, SA_HOR_CENTER);
705
706 /* Draw the total download size */
707 DrawString(tr.left, tr.right, tr.bottom - GetCharacterHeight(FS_NORMAL) + 1, GetString(STR_CONTENT_TOTAL_DOWNLOAD_SIZE, this->filesize_sum));
708
709 if (this->selected == nullptr) return;
710
711 /* And fill the rest of the details when there's information to place there */
712 DrawStringMultiLine(hr.left, hr.right, hr.top + GetCharacterHeight(FS_NORMAL), hr.bottom, STR_CONTENT_DETAIL_SUBTITLE_UNSELECTED + to_underlying(this->selected->state), TC_FROMSTRING, SA_CENTER);
713
714 /* Also show the total download size, so keep some space from the bottom */
715 tr.bottom -= GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_wide;
716
717 if (this->selected->upgrade) {
718 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_UPDATE, STR_CONTENT_TYPE_BASE_GRAPHICS + this->selected->type - CONTENT_TYPE_BASE_GRAPHICS));
719 tr.top += WidgetDimensions::scaled.vsep_wide;
720 }
721
722 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_NAME, this->selected->name));
723
724 if (!this->selected->version.empty()) {
725 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_VERSION, this->selected->version));
726 }
727
728 if (!this->selected->description.empty()) {
729 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_DESCRIPTION, this->selected->description));
730 }
731
732 if (!this->selected->url.empty()) {
733 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_URL, this->selected->url));
734 }
735
736 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_TYPE, STR_CONTENT_TYPE_BASE_GRAPHICS + this->selected->type - CONTENT_TYPE_BASE_GRAPHICS));
737
738 tr.top += WidgetDimensions::scaled.vsep_wide;
739 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_FILESIZE, this->selected->filesize));
740
741 std::string_view list_separator = GetListSeparator();
742 if (!this->selected->dependencies.empty()) {
743 /* List dependencies */
744 std::string buf;
745 for (auto &cid : this->selected->dependencies) {
746 /* Try to find the dependency */
747 for (const ContentInfo &ci : _network_content_client.Info()) {
748 if (ci.id != cid) continue;
749
750 if (!buf.empty()) buf += list_separator;
751 buf += ci.name;
752 break;
753 }
754 }
755 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_DEPENDENCIES, std::move(buf)));
756 }
757
758 if (!this->selected->tags.empty()) {
759 /* List all tags */
760 std::string buf;
761 for (auto &tag : this->selected->tags) {
762 if (!buf.empty()) buf += list_separator;
763 buf += tag;
764 }
765 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_TAGS, std::move(buf)));
766 }
767
768 if (this->selected->IsSelected()) {
769 /* When selected show all manually selected content that depends on this */
770 ConstContentVector tree;
771 _network_content_client.ReverseLookupTreeDependency(tree, this->selected);
772
773 std::string buf;
774 for (const ContentInfo *ci : tree) {
775 if (ci == this->selected || ci->state != ContentInfo::State::Selected) continue;
776
777 if (!buf.empty()) buf += list_separator;
778 buf += ci->name;
779 }
780 if (!buf.empty()) {
781 tr.top = DrawStringMultiLine(tr, GetString(STR_CONTENT_DETAIL_SELECTED_BECAUSE_OF, std::move(buf)));
782 }
783 }
784 }
785
786 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
787 {
788 if (widget >= WID_NCL_TEXTFILE && widget < WID_NCL_TEXTFILE + TFT_CONTENT_END) {
789 if (this->selected == nullptr || this->selected->state != ContentInfo::State::AlreadyHere) return;
790
791 ShowContentTextfileWindow(this, (TextfileType)(widget - WID_NCL_TEXTFILE), this->selected);
792 return;
793 }
794
795 switch (widget) {
796 case WID_NCL_MATRIX: {
797 auto it = this->vscroll->GetScrolledItemFromWidget(this->content, pt.y, this, WID_NCL_MATRIX);
798 if (it == this->content.end()) return; // click out of bounds
799
800 const NWidgetBase *checkbox = this->GetWidget<NWidgetBase>(WID_NCL_CHECKBOX);
801 if (click_count > 1 || IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) {
802 _network_content_client.ToggleSelectedState(**it);
803 this->content.ForceResort();
804 this->content.ForceRebuild();
805 } else {
806 this->selected = *it;
807 this->list_pos = it - this->content.begin();
808 }
809
810 if (this->filter_data.types.Any()) {
811 this->content.ForceRebuild();
812 }
813
814 this->InvalidateData();
815 break;
816 }
817
818 case WID_NCL_CHECKBOX:
819 case WID_NCL_TYPE:
820 case WID_NCL_NAME:
821 if (this->content.SortType() == widget - WID_NCL_CHECKBOX) {
822 this->content.ToggleSortOrder();
823 if (!this->content.empty()) this->list_pos = (int)this->content.size() - this->list_pos - 1;
824 } else {
825 this->content.SetSortType(widget - WID_NCL_CHECKBOX);
826 this->content.ForceResort();
827 this->SortContentList();
828 }
829 this->ScrollToSelected();
830 this->InvalidateData();
831 break;
832
833 case WID_NCL_SELECT_ALL:
834 _network_content_client.SelectAll();
835 this->InvalidateData();
836 break;
837
838 case WID_NCL_SELECT_UPDATE:
839 _network_content_client.SelectUpgrade();
840 this->InvalidateData();
841 break;
842
843 case WID_NCL_UNSELECT:
844 _network_content_client.UnselectAll();
845 this->InvalidateData();
846 break;
847
848 case WID_NCL_OPEN_URL:
849 if (this->selected != nullptr) {
850 OpenBrowser(this->selected->url);
851 }
852 break;
853
854 case WID_NCL_DOWNLOAD:
855 if (BringWindowToFrontById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD) == nullptr) new NetworkContentDownloadStatusWindow();
856 break;
857
858 case WID_NCL_SEARCH_EXTERNAL:
859 if (_accepted_external_search) {
860 this->OpenExternalSearch();
861 } else {
862 ShowQuery(
863 GetEncodedString(STR_CONTENT_SEARCH_EXTERNAL_DISCLAIMER_CAPTION),
864 GetEncodedString(STR_CONTENT_SEARCH_EXTERNAL_DISCLAIMER),
865 this, ExternalSearchDisclaimerCallback);
866 }
867 break;
868 }
869 }
870
871 EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
872 {
873 if (this->vscroll->UpdateListPositionOnKeyPress(this->list_pos, keycode) == ES_NOT_HANDLED) {
874 switch (keycode) {
875 case WKC_SPACE:
876 case WKC_RETURN:
877 if (keycode == WKC_RETURN || !IsWidgetFocused(WID_NCL_FILTER)) {
878 if (this->selected != nullptr) {
879 _network_content_client.ToggleSelectedState(*this->selected);
880 this->content.ForceResort();
881 this->InvalidateData();
882 }
883 if (this->filter_data.types.Any()) {
884 this->content.ForceRebuild();
885 this->InvalidateData();
886 }
887 return ES_HANDLED;
888 }
889 /* space is pressed and filter is focused. */
890 [[fallthrough]];
891
892 default:
893 return ES_NOT_HANDLED;
894 }
895 }
896
897 if (this->content.empty()) {
898 if (this->UpdateFilterState()) {
899 this->content.ForceRebuild();
900 this->InvalidateData();
901 }
902 return ES_HANDLED;
903 }
904
905 this->selected = this->content[this->list_pos];
906
907 if (this->UpdateFilterState()) {
908 this->content.ForceRebuild();
909 } else {
910 /* Scroll to the new content if it is outside the current range. */
911 this->ScrollToSelected();
912 }
913
914 /* redraw window */
915 this->InvalidateData();
916 return ES_HANDLED;
917 }
918
919 void OnEditboxChanged(WidgetID wid) override
920 {
921 if (wid == WID_NCL_FILTER) {
922 this->filter_data.string_filter.SetFilterTerm(this->filter_editbox.text.GetText());
923 this->UpdateFilterState();
924 this->content.ForceRebuild();
925 this->InvalidateData();
926 }
927 }
928
929 void OnResize() override
930 {
931 this->vscroll->SetCapacityFromWidget(this, WID_NCL_MATRIX);
932 }
933
934 void OnReceiveContentInfo(const ContentInfo &rci) override
935 {
936 if (this->auto_select && !rci.IsSelected()) _network_content_client.ToggleSelectedState(rci);
937 this->content.ForceRebuild();
938 this->InvalidateData(0, false);
939 }
940
941 void OnDownloadComplete(ContentID) override
942 {
943 this->content.ForceResort();
944 this->InvalidateData();
945 }
946
947 void OnConnect(bool success) override
948 {
949 if (!success) {
950 ShowErrorMessage(GetEncodedString(STR_CONTENT_ERROR_COULD_NOT_CONNECT), {}, WL_ERROR);
951 this->Close();
952 return;
953 }
954
955 this->InvalidateData();
956 }
957
963 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
964 {
965 if (!gui_scope) return;
966 if (this->content.NeedRebuild()) this->BuildContentList();
967
968 /* To sum all the bytes we intend to download */
969 this->filesize_sum = 0;
970 bool show_select_all = false;
971 bool show_select_upgrade = false;
972 for (const ContentInfo *ci : this->content) {
973 switch (ci->state) {
974 case ContentInfo::State::Selected:
975 case ContentInfo::State::Autoselected:
976 this->filesize_sum += ci->filesize;
977 break;
978
979 case ContentInfo::State::Unselected:
980 show_select_all = true;
981 show_select_upgrade |= ci->upgrade;
982 break;
983
984 default:
985 break;
986 }
987 }
988
989 /* If data == 2 then the status window caused this OnInvalidate */
990 this->SetWidgetDisabledState(WID_NCL_DOWNLOAD, this->filesize_sum == 0 || (FindWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD) != nullptr && data != 2));
991 this->SetWidgetDisabledState(WID_NCL_UNSELECT, this->filesize_sum == 0);
992 this->SetWidgetDisabledState(WID_NCL_SELECT_ALL, !show_select_all);
993 this->SetWidgetDisabledState(WID_NCL_SELECT_UPDATE, !show_select_upgrade || !this->filter_data.string_filter.IsEmpty());
994 this->SetWidgetDisabledState(WID_NCL_OPEN_URL, this->selected == nullptr || this->selected->url.empty());
995 for (TextfileType tft = TFT_CONTENT_BEGIN; tft < TFT_CONTENT_END; tft++) {
996 this->SetWidgetDisabledState(WID_NCL_TEXTFILE + tft, this->selected == nullptr || this->selected->state != ContentInfo::State::AlreadyHere || !this->selected->GetTextfile(tft).has_value());
997 }
998 }
999};
1000
1001 Listing NetworkContentListWindow::last_sorting = {false, 1};
1002 Filtering NetworkContentListWindow::last_filtering = {false, 0};
1003
1004 const std::initializer_list<NetworkContentListWindow::GUIContentList::SortFunction * const> NetworkContentListWindow::sorter_funcs = {
1005 &StateSorter,
1006 &TypeSorter,
1007 &NameSorter,
1008};
1009
1010 const std::initializer_list<NetworkContentListWindow::GUIContentList::FilterFunction * const> NetworkContentListWindow::filter_funcs = {
1011 &TagNameFilter,
1012 &TypeOrSelectedFilter,
1013};
1014
1015std::string NetworkContentListWindow::content_type_strs[CONTENT_TYPE_END];
1016
1020 void BuildContentTypeStringList()
1021{
1022 for (int i = CONTENT_TYPE_BEGIN; i < CONTENT_TYPE_END; i++) {
1023 NetworkContentListWindow::content_type_strs[i] = GetString(STR_CONTENT_TYPE_BASE_GRAPHICS + i - CONTENT_TYPE_BASE_GRAPHICS);
1024 }
1025}
1026
1028 static constexpr std::initializer_list<NWidgetPart> _nested_network_content_list_widgets = {
1029 NWidget(NWID_HORIZONTAL),
1030 NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
1031 NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetStringTip(STR_CONTENT_TITLE),
1032 NWidget(WWT_DEFSIZEBOX, COLOUR_LIGHT_BLUE),
1033 EndContainer(),
1034 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NCL_BACKGROUND),
1035 NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.sparse_resize),
1036 /* Top */
1037 NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
1038 NWidget(WWT_TEXT, INVALID_COLOUR, WID_NCL_FILTER_CAPT), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_CONTENT_FILTER_TITLE), SetAlignment(SA_RIGHT | SA_VERT_CENTER),
1039 NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, WID_NCL_FILTER), SetFill(1, 0), SetResize(1, 0),
1040 SetStringTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
1041 EndContainer(),
1042 /* Lists and info. */
1043 NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
1044 /* Left side. */
1045 NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_sparse, 0),
1046 NWidget(NWID_HORIZONTAL),
1047 NWidget(NWID_VERTICAL),
1048 NWidget(NWID_HORIZONTAL),
1049 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_CHECKBOX), SetStringTip(STR_EMPTY),
1050 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_TYPE),
1051 SetStringTip(STR_CONTENT_TYPE_CAPTION, STR_CONTENT_TYPE_CAPTION_TOOLTIP),
1052 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_NAME), SetResize(1, 0), SetFill(1, 0),
1053 SetStringTip(STR_CONTENT_NAME_CAPTION, STR_CONTENT_NAME_CAPTION_TOOLTIP),
1054 EndContainer(),
1055 NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, WID_NCL_MATRIX), SetResize(1, 1), SetFill(1, 1), SetScrollbar(WID_NCL_SCROLLBAR), SetMatrixDataTip(1, 0, STR_CONTENT_MATRIX_TOOLTIP),
1056 EndContainer(),
1057 NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, WID_NCL_SCROLLBAR),
1058 EndContainer(),
1059 NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
1060 NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NCL_SEL_ALL_UPDATE),
1061 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_SELECT_UPDATE), SetResize(1, 0), SetFill(1, 0),
1062 SetStringTip(STR_CONTENT_SELECT_UPDATES_CAPTION, STR_CONTENT_SELECT_UPDATES_CAPTION_TOOLTIP),
1063 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_SELECT_ALL), SetResize(1, 0), SetFill(1, 0),
1064 SetStringTip(STR_CONTENT_SELECT_ALL_CAPTION, STR_CONTENT_SELECT_ALL_CAPTION_TOOLTIP),
1065 EndContainer(),
1066 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_UNSELECT), SetResize(1, 0), SetFill(1, 0),
1067 SetStringTip(STR_CONTENT_UNSELECT_ALL_CAPTION, STR_CONTENT_UNSELECT_ALL_CAPTION_TOOLTIP),
1068 EndContainer(),
1069 EndContainer(),
1070 /* Right side. */
1071 NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_sparse, 0),
1072 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NCL_DETAILS), SetResize(1, 1), SetFill(1, 1),
1073 EndContainer(),
1074 NWidget(NWID_VERTICAL),
1075 NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
1076 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_OPEN_URL), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_CONTENT_OPEN_URL, STR_CONTENT_OPEN_URL_TOOLTIP),
1077 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_TEXTFILE + TFT_README), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_TEXTFILE_VIEW_README, STR_TEXTFILE_VIEW_README_TOOLTIP),
1078 EndContainer(),
1079 NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
1080 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_TEXTFILE + TFT_CHANGELOG), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_TEXTFILE_VIEW_CHANGELOG, STR_TEXTFILE_VIEW_CHANGELOG_TOOLTIP),
1081 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_TEXTFILE + TFT_LICENSE), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_TEXTFILE_VIEW_LICENCE, STR_TEXTFILE_VIEW_LICENCE_TOOLTIP),
1082 EndContainer(),
1083 EndContainer(),
1084 EndContainer(),
1085 EndContainer(),
1086 /* Bottom. */
1087 NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
1088 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_SEARCH_EXTERNAL), SetResize(1, 0), SetFill(1, 0),
1089 SetStringTip(STR_CONTENT_SEARCH_EXTERNAL, STR_CONTENT_SEARCH_EXTERNAL_TOOLTIP),
1090 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_DOWNLOAD), SetResize(1, 0), SetFill(1, 0),
1091 SetStringTip(STR_CONTENT_DOWNLOAD_CAPTION, STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP),
1092 EndContainer(),
1093 EndContainer(),
1094 /* Resize button. */
1095 NWidget(NWID_HORIZONTAL),
1096 NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
1097 NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE), SetResizeWidgetTypeTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
1098 EndContainer(),
1099 EndContainer(),
1100};
1101
1103 static WindowDesc _network_content_list_desc(
1104 WDP_CENTER, "list_content", 630, 460,
1105 WC_NETWORK_WINDOW, WC_NONE,
1106 {},
1107 _nested_network_content_list_widgets
1108);
1109
1117 void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentType type2)
1118{
1119#if defined(WITH_ZLIB)
1120 ContentTypes types{};
1121 _network_content_client.Clear();
1122 if (cv == nullptr) {
1123 assert(type1 != CONTENT_TYPE_END || type2 == CONTENT_TYPE_END);
1124 assert(type1 == CONTENT_TYPE_END || type1 != type2);
1125 _network_content_client.RequestContentList(type1);
1126 if (type2 != CONTENT_TYPE_END) _network_content_client.RequestContentList(type2);
1127
1128 if (type1 != CONTENT_TYPE_END) types.Set(type1);
1129 if (type2 != CONTENT_TYPE_END) types.Set(type2);
1130 } else {
1131 _network_content_client.RequestContentList(cv, true);
1132 }
1133
1134 CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
1135 new NetworkContentListWindow(_network_content_list_desc, cv != nullptr, types);
1136#else
1137 ShowErrorMessage(
1138 GetEncodedString(STR_CONTENT_NO_ZLIB),
1139 GetEncodedString(STR_CONTENT_NO_ZLIB_SUB),
1140 WL_ERROR);
1141#endif /* WITH_ZLIB */
1142}
AI::Rescan
static void Rescan()
Rescans all searchpaths for available AIs.
Definition ai_core.cpp:318
BaseBitSet::Test
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
Definition base_bitset_type.hpp:141
BaseBitSet::None
constexpr bool None() const
Test if none of the values are set.
Definition base_bitset_type.hpp:188
BaseBitSet::Set
constexpr Timpl & Set()
Set all bits.
Definition base_bitset_type.hpp:40
BaseBitSet::Any
constexpr bool Any(const Timpl &other) const
Test if any of the given values are set.
Definition base_bitset_type.hpp:170
BaseMedia< GraphicsSet >::FindSets
static uint FindSets()
Do the scan for files.
Definition base_media_base.h:191
BaseNetworkContentDownloadStatusWindow
Base window for showing the download status of content.
Definition network_content_gui.h:18
BaseNetworkContentDownloadStatusWindow::cur_id
uint32_t cur_id
The current ID of the downloaded file.
Definition network_content_gui.h:25
BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow
BaseNetworkContentDownloadStatusWindow(WindowDesc &desc)
Create the window with the given description.
Definition network_content_gui.cpp:106
BaseNetworkContentDownloadStatusWindow::downloaded_bytes
uint downloaded_bytes
Number of bytes downloaded.
Definition network_content_gui.h:21
BaseNetworkContentDownloadStatusWindow::total_files
uint total_files
Number of files to download.
Definition network_content_gui.h:22
BaseNetworkContentDownloadStatusWindow::DrawWidget
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition network_content_gui.cpp:138
BaseNetworkContentDownloadStatusWindow::OnDownloadProgress
void OnDownloadProgress(const ContentInfo &ci, int bytes) override
We have progress in the download of a file.
Definition network_content_gui.cpp:166
BaseNetworkContentDownloadStatusWindow::Close
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
Definition network_content_gui.cpp:114
BaseNetworkContentDownloadStatusWindow::name
std::string name
The current name of the downloaded file.
Definition network_content_gui.h:26
BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize
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.
Definition network_content_gui.cpp:120
BaseNetworkContentDownloadStatusWindow::downloaded_files
uint downloaded_files
Number of files downloaded.
Definition network_content_gui.h:23
BaseNetworkContentDownloadStatusWindow::total_bytes
uint total_bytes
Number of bytes to download.
Definition network_content_gui.h:20
ClientNetworkContentSocketHandler::SelectUpgrade
void SelectUpgrade()
Select everything that's an update for something we've got.
Definition network_content.cpp:879
ClientNetworkContentSocketHandler::DownloadSelectedContent
void DownloadSelectedContent(uint &files, uint &bytes, bool fallback=false)
Actually begin downloading the content we selected.
Definition network_content.cpp:292
ClientNetworkContentSocketHandler::RemoveCallback
void RemoveCallback(ContentCallback *cb)
Remove a callback.
Definition network_content.h:141
ClientNetworkContentSocketHandler::ToggleSelectedState
void ToggleSelectedState(const ContentInfo &ci)
Toggle the state of a content info and check its dependencies.
Definition network_content.cpp:898
ClientNetworkContentSocketHandler::UnselectAll
void UnselectAll()
Unselect everything that we've not downloaded so far.
Definition network_content.cpp:890
ClientNetworkContentSocketHandler::RequestContentList
void RequestContentList(ContentType type)
Request the content list for the given type.
Definition network_content.cpp:175
ClientNetworkContentSocketHandler::ReverseLookupTreeDependency
void ReverseLookupTreeDependency(ConstContentVector &tree, const ContentInfo *child) const
Reverse lookup the dependencies of all parents over a given child.
Definition network_content.cpp:934
ClientNetworkContentSocketHandler::AddCallback
void AddCallback(ContentCallback *cb)
Add a callback to this class.
Definition network_content.h:139
ClientNetworkContentSocketHandler::Clear
void Clear()
Clear all downloaded content information.
Definition network_content.cpp:1044
ClientNetworkContentSocketHandler::Info
auto Info() const
Get a read-only view of content info for iterating externally.
Definition network_content.h:134
ClientNetworkContentSocketHandler::Cancel
void Cancel()
Cancel the current download.
Definition network_content.cpp:751
ClientNetworkContentSocketHandler::SelectAll
void SelectAll()
Select everything we can select.
Definition network_content.cpp:868
EnumBitSet< ContentType, uint16_t, CONTENT_TYPE_END >
GUIList
List template of 'things' T to sort in a GUI.
Definition sortlist_type.h:43
GUIList::Filter
bool Filter(FilterFunction *decide, F filter_data)
Filter the list.
Definition sortlist_type.h:342
GUIList::RebuildDone
void RebuildDone()
Notify the sortlist that the rebuild is done.
Definition sortlist_type.h:405
GUIList::SetFiltering
void SetFiltering(Filtering f)
Import filter conditions.
Definition sortlist_type.h:200
GUIList::SetListing
void SetListing(Listing l)
Import sort conditions.
Definition sortlist_type.h:148
GUIList::SetFilterState
void SetFilterState(bool state)
Enable or disable the filter.
Definition sortlist_type.h:326
GUIList::IsDescSortOrder
bool IsDescSortOrder() const
Check if the sort order is descending.
Definition sortlist_type.h:242
GUIList::ToggleSortOrder
void ToggleSortOrder()
Toggle the sort order Since that is the worst condition for the sort function reverse the list here.
Definition sortlist_type.h:252
GUIList::SetFilterFuncs
void SetFilterFuncs(std::span< FilterFunction *const > n_funcs)
Hand the filter function pointers to the GUIList.
Definition sortlist_type.h:365
GUIList::GetFiltering
Filtering GetFiltering() const
Export current filter conditions.
Definition sortlist_type.h:186
GUIList::NeedRebuild
bool NeedRebuild() const
Check if a rebuild is needed.
Definition sortlist_type.h:387
GUIList::SetFilterType
void SetFilterType(uint8_t n_type)
Set the filtertype of the list.
Definition sortlist_type.h:173
GUIList::ForceRebuild
void ForceRebuild()
Force that a rebuild is needed.
Definition sortlist_type.h:395
GUIList::Sort
bool Sort(Comp compare)
Sort the list.
Definition sortlist_type.h:266
GUIList::ForceResort
void ForceResort()
Force a resort next Sort call Reset the resort timer if used too.
Definition sortlist_type.h:232
GUIList::SortType
uint8_t SortType() const
Get the sorttype of the list.
Definition sortlist_type.h:110
GUIList::SetSortFuncs
void SetSortFuncs(std::span< SortFunction *const > n_funcs)
Hand the sort function pointers to the GUIList.
Definition sortlist_type.h:293
GUIList::SetSortType
void SetSortType(uint8_t n_type)
Set the sorttype of the list.
Definition sortlist_type.h:120
NWidgetBase
Baseclass for nested widgets.
Definition widget_type.h:137
NWidgetBase::current_x
uint current_x
Current horizontal size (after resizing).
Definition widget_type.h:238
NWidgetBase::pos_x
int pos_x
Horizontal position of top-left corner of the widget in the window.
Definition widget_type.h:243
NetworkContentListWindow
Window that lists the content that's at the content server.
Definition network_content_gui.cpp:324
NetworkContentListWindow::OnKeyPress
EventState OnKeyPress(char32_t key, uint16_t keycode) override
A key has been pressed.
Definition network_content_gui.cpp:871
NetworkContentListWindow::NameSorter
static bool NameSorter(const ContentInfo *const &a, const ContentInfo *const &b)
Sort content by name.
Definition network_content_gui.cpp:427
NetworkContentListWindow::DrawWidget
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition network_content_gui.cpp:613
NetworkContentListWindow::DrawDetails
void DrawDetails(const Rect &r) const
Helper function to draw the details part of this window.
Definition network_content_gui.cpp:693
NetworkContentListWindow::OpenExternalSearch
void OpenExternalSearch()
Search external websites for content.
Definition network_content_gui.cpp:348
NetworkContentListWindow::DrawMatrix
void DrawMatrix(const Rect &r) const
Draw/fill the matrix with the list of content to download.
Definition network_content_gui.cpp:647
NetworkContentListWindow::OnResize
void OnResize() override
Called after the window got resized.
Definition network_content_gui.cpp:929
NetworkContentListWindow::Close
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
Definition network_content_gui.cpp:571
NetworkContentListWindow::OnReceiveContentInfo
void OnReceiveContentInfo(const ContentInfo &rci) override
We received a content info.
Definition network_content_gui.cpp:934
NetworkContentListWindow::content_type_strs
static std::string content_type_strs[CONTENT_TYPE_END]
Cached strings for all content types.
Definition network_content_gui.cpp:345
NetworkContentListWindow::content
GUIContentList content
List with content.
Definition network_content_gui.cpp:334
NetworkContentListWindow::filesize_sum
uint filesize_sum
The sum of all selected file sizes.
Definition network_content_gui.cpp:342
NetworkContentListWindow::auto_select
bool auto_select
Automatically select all content when the meta-data becomes available.
Definition network_content_gui.cpp:335
NetworkContentListWindow::filter_data
ContentListFilterData filter_data
Filter for content list.
Definition network_content_gui.cpp:336
NetworkContentListWindow::UpdateWidgetSize
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.
Definition network_content_gui.cpp:582
NetworkContentListWindow::last_filtering
static Filtering last_filtering
The last filtering setting.
Definition network_content_gui.cpp:1002
NetworkContentListWindow::filter_editbox
QueryString filter_editbox
Filter editbox;.
Definition network_content_gui.cpp:337
NetworkContentListWindow::sorter_funcs
static const std::initializer_list< GUIContentList::SortFunction *const > sorter_funcs
Sorter functions.
Definition network_content_gui.cpp:1004
NetworkContentListWindow::last_sorting
static Listing last_sorting
The last sorting setting.
Definition network_content_gui.cpp:1001
NetworkContentListWindow::TagNameFilter
static bool TagNameFilter(const ContentInfo *const *a, ContentListFilterData &filter)
Filter content by tags/name.
Definition network_content_gui.cpp:463
NetworkContentListWindow::list_pos
int list_pos
Our position in the list.
Definition network_content_gui.cpp:341
NetworkContentListWindow::TypeOrSelectedFilter
static bool TypeOrSelectedFilter(const ContentInfo *const *a, ContentListFilterData &filter)
Filter content by type, but still show content selected for download.
Definition network_content_gui.cpp:475
NetworkContentListWindow::selected
const ContentInfo * selected
The selected content info.
Definition network_content_gui.cpp:340
NetworkContentListWindow::OnInit
void OnInit() override
Notification that the nested widget tree gets initialized.
Definition network_content_gui.cpp:577
NetworkContentListWindow::filter_funcs
static const std::initializer_list< GUIContentList::FilterFunction *const > filter_funcs
Filter functions.
Definition network_content_gui.cpp:1010
NetworkContentListWindow::TypeSorter
static bool TypeSorter(const ContentInfo *const &a, const ContentInfo *const &b)
Sort content by type.
Definition network_content_gui.cpp:435
NetworkContentListWindow::SortContentList
void SortContentList()
Sort the content list.
Definition network_content_gui.cpp:454
NetworkContentListWindow::ExternalSearchDisclaimerCallback
static void ExternalSearchDisclaimerCallback(Window *w, bool accepted)
Callback function for disclaimer about entering external websites.
Definition network_content_gui.cpp:390
NetworkContentListWindow::UpdateFilterState
bool UpdateFilterState()
Update filter state based on current window state.
Definition network_content_gui.cpp:513
NetworkContentListWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition network_content_gui.cpp:626
NetworkContentListWindow::NetworkContentListWindow
NetworkContentListWindow(WindowDesc &desc, bool select_all, ContentTypes types)
Create the content list window.
Definition network_content_gui.cpp:542
NetworkContentListWindow::GUIContentList
GUIList< const ContentInfo *, std::nullptr_t, ContentListFilterData & > GUIContentList
List with content infos.
Definition network_content_gui.cpp:326
NetworkContentListWindow::EDITBOX_MAX_SIZE
static const uint EDITBOX_MAX_SIZE
Maximum size of the editbox in characters.
Definition network_content_gui.cpp:328
NetworkContentListWindow::OnEditboxChanged
void OnEditboxChanged(WidgetID wid) override
The text in an editbox has been edited.
Definition network_content_gui.cpp:919
NetworkContentListWindow::OnDownloadComplete
void OnDownloadComplete(ContentID) override
We have finished downloading a file.
Definition network_content_gui.cpp:941
NetworkContentListWindow::BuildContentList
void BuildContentList()
(Re)build the network game list as its amount has changed because an item has been added or deleted f...
Definition network_content_gui.cpp:402
NetworkContentListWindow::OnConnect
void OnConnect(bool success) override
Callback for when the connection has finished.
Definition network_content_gui.cpp:947
NetworkContentListWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition network_content_gui.cpp:963
NetworkContentListWindow::vscroll
Scrollbar * vscroll
Cache of the vertical scrollbar.
Definition network_content_gui.cpp:343
NetworkContentListWindow::OnClick
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition network_content_gui.cpp:786
NetworkContentListWindow::BuildContentTypeStringList
friend void BuildContentTypeStringList()
Build array of all strings corresponding to the content types.
Definition network_content_gui.cpp:1020
NetworkContentListWindow::FilterContentList
void FilterContentList()
Filter the content list.
Definition network_content_gui.cpp:483
NetworkContentListWindow::checkbox_size
Dimension checkbox_size
Size of checkbox/"blot" sprite.
Definition network_content_gui.cpp:338
NetworkContentListWindow::ScrollToSelected
void ScrollToSelected()
Make sure that the currently selected content info is within the visible part of the matrix.
Definition network_content_gui.cpp:524
NetworkContentListWindow::StateSorter
static bool StateSorter(const ContentInfo *const &a, const ContentInfo *const &b)
Sort content by state.
Definition network_content_gui.cpp:446
Scrollbar
Scrollbar data structure.
Definition widget_type.h:711
Scrollbar::SetCount
void SetCount(size_t num)
Sets the number of elements in the list.
Definition widget_type.h:795
Scrollbar::GetScrolledItemFromWidget
auto GetScrolledItemFromWidget(Tcontainer &container, int clickpos, const Window *const w, WidgetID widget, int padding=0, int line_height=-1) const
Return an iterator pointing to the element of a scrolled widget that a user clicked in.
Definition widget_type.h:894
Scrollbar::SetCapacityFromWidget
void SetCapacityFromWidget(Window *w, WidgetID widget, int padding=0)
Set capacity of visible elements from the size and resize properties of a widget.
Definition widget.cpp:2527
Scrollbar::UpdateListPositionOnKeyPress
EventState UpdateListPositionOnKeyPress(int &list_position, uint16_t keycode) const
Update the given list position as if it were on this scroll bar when the given keycode was pressed.
Definition widget.cpp:2474
Scrollbar::ScrollTowards
void ScrollTowards(size_type position)
Scroll towards the given position; if the item is visible nothing happens, otherwise it will be shown...
Definition widget_type.h:856
Scrollbar::GetVisibleRangeIterators
auto GetVisibleRangeIterators(Tcontainer &container) const
Get a pair of iterators for the range of visible elements in a container.
Definition widget_type.h:875
TarScanner::Mode::Scenario
@ Scenario
Scan for scenarios and heightmaps.
TarScanner::Mode::Baseset
@ Baseset
Scan for base sets.
TarScanner::DoScan
uint DoScan(Subdirectory sd)
Perform the scanning of a particular subdirectory.
Definition fileio.cpp:377
WidgetDimensions::frametext
RectPadding frametext
Padding inside frame with text.
Definition window_gui.h:41
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition window_gui.h:30
WidgetDimensions::vsep_normal
int vsep_normal
Normal vertical spacing.
Definition window_gui.h:58
WidgetDimensions::vsep_wide
int vsep_wide
Wide vertical spacing.
Definition window_gui.h:60
WidgetDimensions::hsep_wide
int hsep_wide
Wide horizontal spacing.
Definition window_gui.h:62
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:93
WidgetDimensions::matrix
RectPadding matrix
Padding of WWT_MATRIX items.
Definition window_gui.h:42
WidgetDimensions::bevel
RectPadding bevel
Bevel thickness, affected by "scaled bevels" game option.
Definition window_gui.h:38
find_index
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_...
Definition container_func.hpp:41
to_underlying
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23)
Definition enum_type.hpp:17
WL_ERROR
@ WL_ERROR
Errors (eg. saving/loading failed)
Definition error.h:26
ShowErrorMessage
void ShowErrorMessage(EncodedString &&summary_msg, int x, int y, CommandCost &cc)
Display an error message in a window.
Definition error_gui.cpp:296
ScanScenarios
void ScanScenarios()
Force a (re)scan of the scenarios.
Definition fios.cpp:692
GetCharacterHeight
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Definition fontcache.cpp:87
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition geometry_func.cpp:22
CentreBounds
int CentreBounds(int min, int max, int size)
Determine where to position a centred object.
Definition geometry_type.hpp:26
GetStringBoundingBox
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition gfx.cpp:897
DrawString
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.
Definition gfx.cpp:668
DrawStringMultiLine
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.
Definition gfx.cpp:785
GfxFillRect
void GfxFillRect(int left, int top, int right, int bottom, const std::variant< PixelColour, PaletteID > &colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Definition gfx.cpp:115
GetScaledSpriteSize
Dimension GetScaledSpriteSize(SpriteID sprid)
Scale sprite size for GUI.
Definition widget.cpp:68
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition gfx_type.h:17
FS_SMALL
@ FS_SMALL
Index of the small font in the font tables.
Definition gfx_type.h:250
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition gfx_type.h:249
SA_RIGHT
@ SA_RIGHT
Right align the text (must be a single bit).
Definition gfx_type.h:390
SA_HOR_CENTER
@ SA_HOR_CENTER
Horizontally center the text.
Definition gfx_type.h:389
SA_CENTER
@ SA_CENTER
Center both horizontally and vertically.
Definition gfx_type.h:398
SA_VERT_CENTER
@ SA_VERT_CENTER
Vertically center the text.
Definition gfx_type.h:394
SetMatrixDataTip
constexpr NWidgetPart SetMatrixDataTip(uint32_t cols, uint32_t rows, StringID tip={})
Widget part function for setting the data and tooltip of WWT_MATRIX widgets.
Definition widget_type.h:1311
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1222
SetPIP
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
Definition widget_type.h:1378
SetScrollbar
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
Definition widget_type.h:1402
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition widget_type.h:1335
SetStringTip
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
Definition widget_type.h:1243
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1159
SetResizeWidgetTypeTip
constexpr NWidgetPart SetResizeWidgetTypeTip(ResizeWidgetValues widget_type, StringID tip)
Widget part function for setting the resize widget type and tooltip.
Definition widget_type.h:1288
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1232
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1427
SetAlignment
constexpr NWidgetPart SetAlignment(StringAlignment align)
Widget part function for setting the alignment of text/images.
Definition widget_type.h:1211
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1148
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition window.cpp:968
IsInsideBS
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.
Definition math_func.hpp:252
ShowQuery
void ShowQuery(EncodedString &&caption, EncodedString &&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...
Definition misc_gui.cpp:1204
WID_TF_CAPTION
@ WID_TF_CAPTION
The caption of the window.
Definition misc_widget.h:53
_network_content_client
ClientNetworkContentSocketHandler _network_content_client
The client we use to connect to the server.
Definition network_content.cpp:47
ContentVector
std::vector< std::unique_ptr< ContentInfo > > ContentVector
Vector with content info.
Definition network_content.h:20
ConstContentVector
std::vector< const ContentInfo * > ConstContentVector
Vector with constant content info.
Definition network_content.h:22
_accepted_external_search
static bool _accepted_external_search
Whether the user accepted to enter external websites during this session.
Definition network_content_gui.cpp:38
_nested_network_content_list_widgets
static constexpr std::initializer_list< NWidgetPart > _nested_network_content_list_widgets
The widgets for the content list.
Definition network_content_gui.cpp:1028
ShowNetworkContentListWindow
void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentType type2)
Show the content list window with a given set of content.
Definition network_content_gui.cpp:1117
_nested_network_content_download_status_window_widgets
static constexpr std::initializer_list< NWidgetPart > _nested_network_content_download_status_window_widgets
Nested widgets for the download window.
Definition network_content_gui.cpp:87
ContentListFilterCriteria
ContentListFilterCriteria
Filter criteria for NetworkContentListWindow.
Definition network_content_gui.cpp:318
CONTENT_FILTER_TYPE_OR_SELECTED
@ CONTENT_FILTER_TYPE_OR_SELECTED
Filter by being of displayed type or selected for download.
Definition network_content_gui.cpp:320
CONTENT_FILTER_TEXT
@ CONTENT_FILTER_TEXT
Filter by query string.
Definition network_content_gui.cpp:319
_network_content_download_status_window_desc
static WindowDesc _network_content_download_status_window_desc(WDP_CENTER, {}, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WindowDefaultFlag::Modal, _nested_network_content_download_status_window_widgets)
Window description for the download window.
_network_content_list_desc
static WindowDesc _network_content_list_desc(WDP_CENTER, "list_content", 630, 460, WC_NETWORK_WINDOW, WC_NONE, {}, _nested_network_content_list_widgets)
Window description of the content list.
BuildContentTypeStringList
void BuildContentTypeStringList()
Build array of all strings corresponding to the content types.
Definition network_content_gui.cpp:1020
network_content_gui.h
User interface for downloading files.
WID_NCL_CHECKBOX
@ WID_NCL_CHECKBOX
Button above checkboxes.
Definition network_content_widget.h:29
WID_NCL_NAME
@ WID_NCL_NAME
'Name' button.
Definition network_content_widget.h:31
WID_NCL_TYPE
@ WID_NCL_TYPE
'Type' button.
Definition network_content_widget.h:30
WID_NCL_SEARCH_EXTERNAL
@ WID_NCL_SEARCH_EXTERNAL
Search external sites for missing NewGRF.
Definition network_content_widget.h:46
WID_NCL_DETAILS
@ WID_NCL_DETAILS
Panel with content details.
Definition network_content_widget.h:36
WID_NCL_SEL_ALL_UPDATE
@ WID_NCL_SEL_ALL_UPDATE
NWID_SELECTION widget for select all/update buttons..
Definition network_content_widget.h:45
WID_NCL_SELECT_ALL
@ WID_NCL_SELECT_ALL
'Select all' button.
Definition network_content_widget.h:39
WID_NCL_FILTER
@ WID_NCL_FILTER
Filter editbox.
Definition network_content_widget.h:27
WID_NCL_FILTER_CAPT
@ WID_NCL_FILTER_CAPT
Caption for the filter editbox.
Definition network_content_widget.h:26
WID_NCL_DOWNLOAD
@ WID_NCL_DOWNLOAD
'Download' button.
Definition network_content_widget.h:43
WID_NCL_SCROLLBAR
@ WID_NCL_SCROLLBAR
Scrollbar of matrix.
Definition network_content_widget.h:34
WID_NCL_SELECT_UPDATE
@ WID_NCL_SELECT_UPDATE
'Select updates' button.
Definition network_content_widget.h:40
WID_NCL_TEXTFILE
@ WID_NCL_TEXTFILE
Open readme, changelog (+1) or license (+2) of a file in the content window.
Definition network_content_widget.h:37
WID_NCL_MATRIX
@ WID_NCL_MATRIX
Panel with list of content.
Definition network_content_widget.h:33
WID_NCL_BACKGROUND
@ WID_NCL_BACKGROUND
Resize button.
Definition network_content_widget.h:24
WID_NCL_UNSELECT
@ WID_NCL_UNSELECT
'Unselect all' button.
Definition network_content_widget.h:41
WID_NCL_OPEN_URL
@ WID_NCL_OPEN_URL
'Open url' button.
Definition network_content_widget.h:42
WID_NCDS_CANCELOK
@ WID_NCDS_CANCELOK
(Optional) Cancel/OK button.
Definition network_content_widget.h:19
WID_NCDS_PROGRESS_TEXT
@ WID_NCDS_PROGRESS_TEXT
Text explaining what is happening.
Definition network_content_widget.h:18
WID_NCDS_PROGRESS_BAR
@ WID_NCDS_PROGRESS_BAR
Simple progress bar.
Definition network_content_widget.h:17
RequestNewGRFScan
bool RequestNewGRFScan(NewGRFScanCallback *callback)
Request a new NewGRF scan.
Definition openttd.cpp:1327
GetColourGradient
PixelColour GetColourGradient(Colours colour, ColourShade shade)
Get colour gradient palette index.
Definition palette.cpp:388
PC_GREY
static constexpr PixelColour PC_GREY
Grey palette colour.
Definition palette_func.h:98
FormatArrayAsHex
std::string FormatArrayAsHex(std::span< const uint8_t > data)
Format a byte array into a continuous hex string.
Definition string.cpp:77
StrNaturalCompare
int StrNaturalCompare(std::string_view s1, std::string_view s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
Definition string.cpp:427
GetListSeparator
std::string_view GetListSeparator()
Get the list separator string for the current language.
Definition strings.cpp:299
GetEncodedString
EncodedString GetEncodedString(StringID str)
Encode a string with no parameters into an encoded string.
Definition strings.cpp:90
GetString
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
Definition strings.cpp:424
_current_text_dir
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition strings.cpp:56
GetParamMaxDigits
uint64_t GetParamMaxDigits(uint count, FontSize size)
Get some number that is suitable for string size computations.
Definition strings.cpp:218
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition strings_type.h:19
TD_RTL
@ TD_RTL
Text is written right-to-left by default.
Definition strings_type.h:27
ContentCallback
Callbacks for notifying others about incoming data.
Definition network_content.h:25
ContentInfo
Container for all important information about a piece of content.
Definition tcp_content_type.h:56
ContentInfo::unique_id
uint32_t unique_id
Unique ID; either GRF ID or shortname.
Definition tcp_content_type.h:75
ContentInfo::filesize
uint32_t filesize
Size of the file.
Definition tcp_content_type.h:69
ContentInfo::md5sum
MD5Hash md5sum
The MD5 checksum.
Definition tcp_content_type.h:76
ContentInfo::url
std::string url
URL related to the content.
Definition tcp_content_type.h:73
ContentInfo::state
State state
Whether the content info is selected (for download)
Definition tcp_content_type.h:79
ContentInfo::name
std::string name
Name of the content.
Definition tcp_content_type.h:71
ContentInfo::description
std::string description
Description of the content.
Definition tcp_content_type.h:74
ContentInfo::GetTextfile
std::optional< std::string > GetTextfile(TextfileType type) const
Search a textfile file next to this file in the content list.
Definition tcp_content.cpp:59
ContentInfo::version
std::string version
Version of the content.
Definition tcp_content_type.h:72
ContentInfo::id
ContentID id
Unique (server side) ID for the content.
Definition tcp_content_type.h:68
ContentInfo::filename
std::string filename
Filename (for the .tar.gz; only valid on download)
Definition tcp_content_type.h:70
ContentInfo::IsSelected
bool IsSelected() const
Is the state either selected or autoselected?
Definition tcp_content.cpp:32
ContentInfo::type
ContentType type
Type of content.
Definition tcp_content_type.h:67
ContentInfo::dependencies
std::vector< ContentID > dependencies
The dependencies (unique server side ids)
Definition tcp_content_type.h:77
ContentInfo::State::Unselected
@ Unselected
The content has not been selected.
ContentInfo::State::AlreadyHere
@ AlreadyHere
The content is already at the client side.
ContentInfo::State::Selected
@ Selected
The content has been manually selected.
ContentInfo::State::Autoselected
@ Autoselected
The content has been selected as dependency.
ContentInfo::State::DoesNotExist
@ DoesNotExist
The content does not exist in the content system.
ContentInfo::tags
StringList tags
Tags associated with the content.
Definition tcp_content_type.h:78
ContentInfo::upgrade
bool upgrade
This item is an upgrade.
Definition tcp_content_type.h:80
ContentListFilterData
Filter data for NetworkContentListWindow.
Definition network_content_gui.cpp:312
ContentListFilterData::string_filter
StringFilter string_filter
Text filter of content list.
Definition network_content_gui.cpp:313
ContentListFilterData::types
ContentTypes types
Content types displayed.
Definition network_content_gui.cpp:314
ContentTextfileWindow
Window for displaying the textfile of an item in the content list.
Definition network_content_gui.cpp:42
ContentTextfileWindow::ci
const ContentInfo * ci
View the textfile of this ContentInfo.
Definition network_content_gui.cpp:43
ContentTextfileWindow::GetWidgetString
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
Definition network_content_gui.cpp:70
Coord2D< int >
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition geometry_type.hpp:56
Filtering
Data structure describing what to show in the list (filter criteria).
Definition sortlist_type.h:31
Filtering::state
bool state
Filter on/off.
Definition sortlist_type.h:32
Listing
Data structure describing how to show the list (what sort direction and criteria).
Definition sortlist_type.h:26
NetworkContentDownloadStatusWindow
Window for showing the download status of content.
Definition network_content_gui.cpp:186
NetworkContentDownloadStatusWindow::OnDownloadProgress
void OnDownloadProgress(const ContentInfo &ci, int bytes) override
We have progress in the download of a file.
Definition network_content_gui.cpp:299
NetworkContentDownloadStatusWindow::received_types
ContentTypes received_types
Types we received so we can update their cache.
Definition network_content_gui.cpp:188
NetworkContentDownloadStatusWindow::NetworkContentDownloadStatusWindow
NetworkContentDownloadStatusWindow()
Create a new download window based on a list of content information with flags whether to download th...
Definition network_content_gui.cpp:195
NetworkContentDownloadStatusWindow::OnClick
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition network_content_gui.cpp:285
NetworkContentDownloadStatusWindow::Close
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
Definition network_content_gui.cpp:200
QueryString
Data stored about a string that can be modified in the GUI.
Definition querystring_gui.h:20
QueryString::cancel_button
int cancel_button
Widget button of parent window to simulate when pressing CANCEL in OSK.
Definition querystring_gui.h:28
QueryString::ACTION_CLEAR
static const int ACTION_CLEAR
Clear editbox.
Definition querystring_gui.h:24
RectPadding::Horizontal
constexpr uint Horizontal() const
Get total horizontal padding of RectPadding.
Definition geometry_type.hpp:89
RectPadding::Vertical
constexpr uint Vertical() const
Get total vertical padding of RectPadding.
Definition geometry_type.hpp:95
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition geometry_type.hpp:101
Rect::Shrink
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Definition geometry_type.hpp:124
Rect::WithHeight
Rect WithHeight(int height, bool end=false) const
Copy Rect and set its height.
Definition geometry_type.hpp:237
Rect::WithY
Rect WithY(int new_top, int new_bottom) const
Create a new Rect, replacing the top and bottom coordiates.
Definition geometry_type.hpp:280
Rect::Translate
Rect Translate(int x, int y) const
Copy and translate Rect by x,y pixels.
Definition geometry_type.hpp:200
StringFilter
String filter and state.
Definition stringfilter_type.h:30
StringFilter::IsEmpty
bool IsEmpty() const
Check whether any filter words were entered.
Definition stringfilter_type.h:57
StringFilter::SetFilterTerm
void SetFilterTerm(std::string_view str)
Set the term to filter on.
Definition stringfilter.cpp:29
StringFilter::ResetState
void ResetState()
Reset the matching state to process a new item.
Definition stringfilter.cpp:80
StringFilter::GetState
bool GetState() const
Get the matching state of the current item.
Definition stringfilter_type.h:67
Textbuf::GetText
std::string_view GetText() const
Get the current text.
Definition textbuf.cpp:284
TextfileWindow
Window for displaying a textfile.
Definition textfile_gui.h:22
TextfileWindow::file_type
TextfileType file_type
Type of textfile to view.
Definition textfile_gui.h:23
TextfileWindow::LoadTextfile
virtual void LoadTextfile(const std::string &textfile, Subdirectory dir)
Loads the textfile text from file and setup lines.
Definition textfile_gui.cpp:851
WindowDesc
High level window description.
Definition window_gui.h:168
Window
Data structure for an opened window.
Definition window_gui.h:274
Window::Close
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
Definition window.cpp:1104
Window::SortButtonWidth
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
Definition widget.cpp:833
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition window.cpp:1809
Window::querystrings
std::map< WidgetID, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
Definition window_gui.h:321
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition widget.cpp:784
Window::InvalidateData
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
Definition window.cpp:3237
Window::parent
Window * parent
Parent window.
Definition window_gui.h:329
Window::GetWidgetString
virtual std::string GetWidgetString(WidgetID widget, StringID stringid) const
Get the raw string for a widget.
Definition window.cpp:506
Window::DrawSortButtonState
void DrawSortButtonState(WidgetID widget, SortButtonState state) const
Draw a sort button's up or down arrow symbol.
Definition widget.cpp:816
Window::resize
ResizeInfo resize
Resize information.
Definition window_gui.h:315
Window::IsWidgetFocused
bool IsWidgetFocused(WidgetID widget_index) const
Check if given widget is focused within this window.
Definition window_gui.h:421
Window::CreateNestedTree
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
Definition window.cpp:1799
Window::CloseChildWindowById
void CloseChildWindowById(WindowClass wc, WindowNumber number) const
Close all children a window might have in a head-recursive manner.
Definition window.cpp:1092
Window::SetFocusedWidget
bool SetFocusedWidget(WidgetID widget_index)
Set focus within this window to the given widget.
Definition window.cpp:487
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition window.cpp:1823
Window::GetScrollbar
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
Definition window.cpp:315
Window::SetWidgetDisabledState
void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Definition window_gui.h:382
GetContentInfoSubDir
Subdirectory GetContentInfoSubDir(ContentType type)
Helper to get the subdirectory a ContentInfo is located in.
Definition tcp_content.cpp:190
ContentID
uint32_t ContentID
Unique identifier for the content.
Definition tcp_content_type.h:51
ContentType
ContentType
The values in the enum are important; they are used as database 'keys'.
Definition tcp_content_type.h:21
CONTENT_TYPE_AI_LIBRARY
@ CONTENT_TYPE_AI_LIBRARY
The content consists of an AI library.
Definition tcp_content_type.h:26
CONTENT_TYPE_BASE_SOUNDS
@ CONTENT_TYPE_BASE_SOUNDS
The content consists of base sounds.
Definition tcp_content_type.h:29
CONTENT_TYPE_GAME_LIBRARY
@ CONTENT_TYPE_GAME_LIBRARY
The content consists of a GS library.
Definition tcp_content_type.h:32
CONTENT_TYPE_BASE_GRAPHICS
@ CONTENT_TYPE_BASE_GRAPHICS
The content consists of base graphics.
Definition tcp_content_type.h:23
CONTENT_TYPE_AI
@ CONTENT_TYPE_AI
The content consists of an AI.
Definition tcp_content_type.h:25
CONTENT_TYPE_SCENARIO
@ CONTENT_TYPE_SCENARIO
The content consists of a scenario.
Definition tcp_content_type.h:27
CONTENT_TYPE_NEWGRF
@ CONTENT_TYPE_NEWGRF
The content consists of a NewGRF.
Definition tcp_content_type.h:24
CONTENT_TYPE_BEGIN
@ CONTENT_TYPE_BEGIN
Helper to mark the begin of the types.
Definition tcp_content_type.h:22
CONTENT_TYPE_BASE_MUSIC
@ CONTENT_TYPE_BASE_MUSIC
The content consists of base music.
Definition tcp_content_type.h:30
CONTENT_TYPE_GAME
@ CONTENT_TYPE_GAME
The content consists of a game script.
Definition tcp_content_type.h:31
CONTENT_TYPE_END
@ CONTENT_TYPE_END
Helper to mark the end of the types.
Definition tcp_content_type.h:33
CONTENT_TYPE_HEIGHTMAP
@ CONTENT_TYPE_HEIGHTMAP
The content consists of a heightmap.
Definition tcp_content_type.h:28
TextfileType
TextfileType
Additional text files accompanying Tar archives.
Definition textfile_type.h:14
TFT_LICENSE
@ TFT_LICENSE
Content license.
Definition textfile_type.h:19
TFT_README
@ TFT_README
Content readme.
Definition textfile_type.h:17
TFT_CHANGELOG
@ TFT_CHANGELOG
Content changelog.
Definition textfile_type.h:18
DrawFrameRect
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
Draw frame rectangle.
Definition widget.cpp:307
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:105
NWID_SPACER
@ NWID_SPACER
Invisible widget that takes some space.
Definition widget_type.h:70
WWT_EDITBOX
@ WWT_EDITBOX
a textbox for typing
Definition widget_type.h:62
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
WWT_MATRIX
@ WWT_MATRIX
Grid of rows and columns.
Definition widget_type.h:50
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:52
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition widget_type.h:76
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:60
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget tree.
Definition widget_type.h:37
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition widget_type.h:59
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition widget_type.h:56
WWT_TEXT
@ WWT_TEXT
Pure simple text.
Definition widget_type.h:49
NWID_SELECTION
@ NWID_SELECTION
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition widget_type.h:71
EqualSize
@ EqualSize
Containers should keep all their (resizing) children equally large.
Definition widget_type.h:544
RWV_HIDE_BEVEL
@ RWV_HIDE_BEVEL
Bevel of resize box is hidden.
Definition widget_type.h:29
CloseWindowById
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Definition window.cpp:1195
InvalidateWindowData
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
Definition window.cpp:3297
BringWindowToFrontById
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
Definition window.cpp:1278
FindWindowById
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Definition window.cpp:1153
SetWindowDirty
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
Definition window.cpp:3179
WindowDefaultFlag::Modal
@ Modal
The window is a modal child of some other window, meaning the parent is 'inactive'.
FrameFlag::BorderOnly
@ BorderOnly
Draw border only, no background.
FrameFlag::Lowered
@ Lowered
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
SortButtonState
SortButtonState
State of a sort direction button.
Definition window_gui.h:217
SBS_DOWN
@ SBS_DOWN
Sort ascending.
Definition window_gui.h:219
SBS_UP
@ SBS_UP
Sort descending.
Definition window_gui.h:220
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition window_gui.h:145
WidgetID
int WidgetID
Widget ID.
Definition window_type.h:20
WN_NETWORK_WINDOW_CONTENT_LIST
@ WN_NETWORK_WINDOW_CONTENT_LIST
Network content list.
Definition window_type.h:41
WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD
@ WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD
Network content download status.
Definition window_type.h:45
WN_GAME_OPTIONS_GAME_OPTIONS
@ WN_GAME_OPTIONS_GAME_OPTIONS
Game options.
Definition window_type.h:31
EventState
EventState
State of handling an event.
Definition window_type.h:780
ES_HANDLED
@ ES_HANDLED
The passed event is handled.
Definition window_type.h:781
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition window_type.h:782
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition window_type.h:50
WC_GAME_OPTIONS
@ WC_GAME_OPTIONS
Game options window; Window numbers:
Definition window_type.h:635
WC_NETWORK_WINDOW
@ WC_NETWORK_WINDOW
Network window; Window numbers:
Definition window_type.h:483
WC_TEXTFILE
@ WC_TEXTFILE
textfile; Window numbers:
Definition window_type.h:192
WC_SAVELOAD
@ WC_SAVELOAD
Saveload window; Window numbers:
Definition window_type.h:149
WC_NETWORK_STATUS_WINDOW
@ WC_NETWORK_STATUS_WINDOW
Network status window; Window numbers:
Definition window_type.h:496