OpenTTD Source  20241121-master-g67a0fccfad
help_gui.cpp File Reference

GUI to access manuals and related. More...

#include "stdafx.h"
#include "gui.h"
#include "window_gui.h"
#include "textfile_gui.h"
#include "fileio_func.h"
#include "table/control_codes.h"
#include "string_func.h"
#include "openttd.h"
#include "help_gui.h"
#include "widgets/help_widget.h"
#include "widgets/misc_widget.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  GameManualTextfileWindow
 Window class displaying the game manual textfile viewer. More...
 
struct  HelpWindow
 Window class displaying the help window. More...
 

Functions

static std::optional< std::string > FindGameManualFilePath (std::string_view filename)
 Find the path to the game manual file. More...
 
void ShowHelpWindow ()
 

Variables

static const std::string README_FILENAME = "README.md"
 
static const std::string CHANGELOG_FILENAME = "changelog.md"
 
static const std::string KNOWN_BUGS_FILENAME = "known-bugs.md"
 
static const std::string LICENSE_FILENAME = "COPYING.md"
 
static const std::string WEBSITE_LINK = "https://www.openttd.org/"
 
static const std::string WIKI_LINK = "https://wiki.openttd.org/"
 
static const std::string BUGTRACKER_LINK = "https://bugs.openttd.org/"
 
static const std::string COMMUNITY_LINK = "https://community.openttd.org/"
 
static constexpr size_t CHANGELOG_VERSIONS_LIMIT = 20
 Only show the first 20 changelog versions in the textfile viewer.
 
static constexpr NWidgetPart _nested_helpwin_widgets []
 
static WindowDesc _helpwin_desc (WDP_CENTER, nullptr, 0, 0, WC_HELPWIN, WC_NONE, 0, _nested_helpwin_widgets)
 

Detailed Description

GUI to access manuals and related.

Definition in file help_gui.cpp.

Function Documentation

◆ FindGameManualFilePath()

static std::optional<std::string> FindGameManualFilePath ( std::string_view  filename)
static

Find the path to the game manual file.

Parameters
filenameThe filename to find.
Returns
std::string The path to the filename if found.

Definition at line 44 of file help_gui.cpp.

References SP_APPLICATION_BUNDLE_DIR, SP_BINARY_DIR, SP_INSTALLATION_DIR, SP_SHARED_DIR, and SP_WORKING_DIR.

Variable Documentation

◆ _nested_helpwin_widgets

constexpr NWidgetPart _nested_helpwin_widgets[]
staticconstexpr
Initial value:
= {
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_HELP_WINDOW_CAPTION, STR_NULL),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
NWidget(WWT_FRAME, COLOUR_DARK_GREEN), SetDataTip(STR_HELP_WINDOW_WEBSITES, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_WEBSITE), SetDataTip(STR_HELP_WINDOW_MAIN_WEBSITE, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_WIKI), SetDataTip(STR_HELP_WINDOW_MANUAL_WIKI, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_BUGTRACKER), SetDataTip(STR_HELP_WINDOW_BUGTRACKER, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_COMMUNITY), SetDataTip(STR_HELP_WINDOW_COMMUNITY, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_FRAME, COLOUR_DARK_GREEN), SetDataTip(STR_HELP_WINDOW_DOCUMENTS, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_README), SetDataTip(STR_HELP_WINDOW_README, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_CHANGELOG), SetDataTip(STR_HELP_WINDOW_CHANGELOG, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_KNOWN_BUGS),SetDataTip(STR_HELP_WINDOW_KNOWN_BUGS, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_HW_LICENSE), SetDataTip(STR_HELP_WINDOW_LICENSE, STR_NULL), SetMinimalSize(128, 12), SetFill(1, 0),
}
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition: window_gui.h:67
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1181
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:1260
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:1228
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1202
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1137
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1309
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1191
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:112
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:75
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:50
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:69
@ WWT_FRAME
Frame.
Definition: widget_type.h:60

Definition at line 168 of file help_gui.cpp.