OpenTTD Source
20240919-master-gdf0233f4c2
|
Go to the documentation of this file.
10 #ifndef TEXTFILE_GUI_H
11 #define TEXTFILE_GUI_H
27 void OnClick([[maybe_unused]]
Point pt,
WidgetID widget, [[maybe_unused]]
int click_count)
override;
28 void DrawWidget(
const Rect &r,
WidgetID widget)
const override;
30 void OnInvalidateData(
int data = 0,
bool gui_scope =
true)
override;
31 void OnDropdownSelect(
WidgetID widget,
int index)
override;
33 void Reset()
override;
35 std::optional<std::string_view>
NextString()
override;
38 void ScrollToLine(
size_t line);
44 void ConstructWindow();
104 uint GetContentHeight();
FontSize DefaultSize() override
Get the default (font) size of the string.
virtual void OnHyperlinkClick(const Hyperlink &link)
Handle the clicking on a hyperlink.
std::vector< HistoryEntry > history
Browsing history in this window.
void AfterLoadMarkdown()
Post-processing of markdown files.
A searcher for missing glyphs.
Dimensions (a width and height) of a rectangle in 2D.
int bottom
Bottom scroll position in visual lines.
uint ReflowContent()
Get the total height of the content displayed in this window, if wrapping is disabled.
void OnResize() override
Called after the window got resized.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
int top
Top scroll position in visual lines.
void SetFontNames(FontCacheSettings *settings, const char *font_name, const void *os_data) override
Set the right font names.
TextfileType file_type
Type of textfile to view.
void CheckHyperlinkClick(Point pt)
Check if the user clicked on a hyperlink, and handle it if so.
void NavigateHistory(int delta)
Navigate through the history, either forward or backward.
std::optional< std::string_view > NextString() override
Get the next string to search through.
int scrollpos
Scrolling position the file was at at navigation time.
size_t history_pos
Position in browsing history (for forward movement).
Settings for the four different fonts.
ResizeInfo resize
Resize information.
virtual void AfterLoadText()
Post-processing after the text is loaded.
std::vector< Hyperlink > links
Clickable links in lines.
std::string destination
Destination for the link.
void LoadText(std::string_view buf)
Load a text into the textfile viewer.
virtual void LoadTextfile(const std::string &textfile, Subdirectory dir)
Loads the textfile text from file and setup lines.
void SetupScrollbars(bool force_reflow)
Set scrollbars to the right lengths.
fluid_settings_t * settings
FluidSynth settings handle.
Coordinates of a point in 2D.
TextColour colour
Colour to render text line in.
void FindHyperlinksInMarkdown(Line &line, size_t line_index)
Find any hyperlinks in a given line.
std::vector< size_t > jumplist
Table of contents list, line numbers.
std::string filepath
File the history entry is in.
Scrollbar * hscroll
Horizontal scrollbar.
uint max_length
Maximum length of unwrapped text line.
void Reset() override
Reset the search, i.e.
uint search_iterator
Iterator for the font check search.
void UpdateHistoryScrollpos()
Update the scroll position to the current, so we can restore there if we go back.
std::string filepath
Full path to the filename.
bool Monospace() override
Whether to search for a monospace font or not.
std::vector< Line > lines
#text, split into lines in a table with lines.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
bool trusted
Whether the content is trusted (read: not from content like NewGRFs, etc).
void AppendHistory(const std::string &filepath)
Append the new location to the history, so the user can go back.
std::optional< std::string > GetTextfile(TextfileType type, Subdirectory dir, const std::string &filename)
Search a textfile file next to the given content.
size_t begin
Character position on line the link begins.
std::vector< Hyperlink > link_anchors
Anchor names of headings that can be linked to.
size_t line
Which line the link is on.
std::string text
Contents of the line.
Window for displaying a textfile.
FontSize
Available font sizes.
Data structure for an opened window.
TextfileType
Additional text files accompanying Tar archives.
void NavigateToFile(std::string newfile, size_t line)
Navigate to the requested file.
std::string filename
Filename of the textfile.
Specification of a rectangle with absolute coordinates of all edges.
size_t end
Character position on line the link end.
Scrollbar * vscroll
Vertical scrollbar.