Merge branch 'master' into jgrpp
# Conflicts: # src/company_cmd.cpp # src/core/overflowsafe_type.hpp # src/economy.cpp # src/engine_base.h # src/ground_vehicle.cpp # src/group_gui.cpp # src/industry_cmd.cpp # src/industry_gui.cpp # src/newgrf_commons.cpp # src/newgrf_engine.cpp # src/newgrf_industries.cpp # src/newgrf_object.cpp # src/newgrf_roadstop.cpp # src/newgrf_station.cpp # src/rail_gui.cpp # src/road_cmd.h # src/road_gui.cpp # src/saveload/afterload.cpp # src/script/api/script_log.cpp # src/script/api/script_log.hpp # src/settings_gui.cpp # src/settingsgen/settingsgen.cpp # src/station_cmd.cpp # src/station_cmd.h # src/station_gui.cpp # src/strgen/strgen.cpp # src/string_func.h # src/string_type.h # src/table/settings/network_private_settings.ini # src/tests/math_func.cpp # src/textfile_gui.cpp # src/timetable_gui.cpp # src/town_cmd.cpp # src/vehicle.cpp # src/waypoint_cmd.cpp # src/waypoint_cmd.h # src/widgets/dropdown.cpp
This commit is contained in:
@@ -19,25 +19,14 @@ const char *GetTextfile(TextfileType type, Subdirectory dir, const char *filenam
|
||||
|
||||
/** Window for displaying a textfile */
|
||||
struct TextfileWindow : public Window, MissingGlyphSearcher {
|
||||
struct Line {
|
||||
int top; ///< Top scroll position.
|
||||
int bottom; ///< Bottom scroll position.
|
||||
const char *text; ///< Pointer to text buffer.
|
||||
|
||||
Line(int top, const char *text) : top(top), bottom(top + 1), text(text) {}
|
||||
};
|
||||
|
||||
TextfileType file_type; ///< Type of textfile to view.
|
||||
Scrollbar *vscroll; ///< Vertical scrollbar.
|
||||
Scrollbar *hscroll; ///< Horizontal scrollbar.
|
||||
char *text; ///< Lines of text from the NewGRF's textfile.
|
||||
std::vector<Line> lines; ///< #text, split into lines in a table with lines.
|
||||
uint search_iterator; ///< Iterator for the font check search.
|
||||
|
||||
uint max_length; ///< Maximum length of unwrapped text line.
|
||||
|
||||
TextfileWindow(TextfileType file_type);
|
||||
~TextfileWindow();
|
||||
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override;
|
||||
void OnClick(Point pt, int widget, int click_count) override;
|
||||
@@ -47,13 +36,24 @@ struct TextfileWindow : public Window, MissingGlyphSearcher {
|
||||
|
||||
void Reset() override;
|
||||
FontSize DefaultSize() override;
|
||||
const char *NextString() override;
|
||||
std::optional<std::string_view> NextString() override;
|
||||
bool Monospace() override;
|
||||
void SetFontNames(FontCacheSettings *settings, const char *font_name, const void *os_data) override;
|
||||
|
||||
virtual void LoadTextfile(const char *textfile, Subdirectory dir);
|
||||
|
||||
private:
|
||||
struct Line {
|
||||
int top; ///< Top scroll position.
|
||||
int bottom; ///< Bottom scroll position.
|
||||
std::string_view text; ///< Pointer to text buffer.
|
||||
|
||||
Line(int top, std::string_view text) : top(top), bottom(top + 1), text(text) {}
|
||||
};
|
||||
|
||||
std::string text; ///< Lines of text from the NewGRF's textfile.
|
||||
std::vector<Line> lines; ///< #text, split into lines in a table with lines.
|
||||
|
||||
uint ReflowContent();
|
||||
uint GetContentHeight();
|
||||
void SetupScrollbars(bool force_reflow);
|
||||
|
Reference in New Issue
Block a user