|
@@ -25,12 +25,14 @@
|
|
|
#include "querystring_gui.h"
|
|
|
#include "core/geometry_func.hpp"
|
|
|
#include "newgrf_text.h"
|
|
|
#include "fileio_func.h"
|
|
|
#include "fontcache.h"
|
|
|
|
|
|
#include "widgets/newgrf_widget.h"
|
|
|
|
|
|
#include "table/strings.h"
|
|
|
#include "table/sprites.h"
|
|
|
|
|
|
/**
|
|
|
* Show the first NewGRF error we can find.
|
|
|
*/
|
|
@@ -134,28 +136,12 @@ static void ShowNewGRFInfo(const GRFConf
|
|
|
y = DrawStringMultiLine(x, right, y, bottom, STR_BLACK_STRING);
|
|
|
} else {
|
|
|
y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_NO_INFO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/** Enum referring to the widgets of the NewGRF parameters window */
|
|
|
enum ShowNewGRFParametersWidgets {
|
|
|
GRFPAR_WIDGET_SHOW_NUMPAR, ///< #NWID_SELECTION to optionally display #GRFPAR_WIDGET_NUMPAR
|
|
|
GRFPAR_WIDGET_NUMPAR_DEC, ///< Button to decrease number of parameters
|
|
|
GRFPAR_WIDGET_NUMPAR_INC, ///< Button to increase number of parameters
|
|
|
GRFPAR_WIDGET_NUMPAR, ///< Optional number of parameters
|
|
|
GRFPAR_WIDGET_NUMPAR_TEXT, ///< Text description
|
|
|
GRFPAR_WIDGET_BACKGROUND, ///< Panel to draw the settings on
|
|
|
GRFPAR_WIDGET_SCROLLBAR, ///< Scrollbar to scroll through all settings
|
|
|
GRFPAR_WIDGET_ACCEPT, ///< Accept button
|
|
|
GRFPAR_WIDGET_RESET, ///< Reset button
|
|
|
GRFPAR_WIDGET_SHOW_DESCRIPTION, ///< #NWID_SELECTION to optionally display parameter descriptions
|
|
|
GRFPAR_WIDGET_DESCRIPTION, ///< Multi-line description of a parameter
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Window for setting the parameters of a NewGRF.
|
|
|
*/
|
|
|
struct NewGRFParametersWindow : public Window {
|
|
|
static GRFParameterInfo dummy_parameter_info; ///< Dummy info in case a newgrf didn't provide info about some parameter.
|
|
|
GRFConfig *grf_config; ///< Set the parameters of this GRFConfig.
|
|
@@ -463,20 +449,12 @@ static const WindowDesc _newgrf_paramete
|
|
|
void OpenGRFParameterWindow(GRFConfig *c)
|
|
|
{
|
|
|
DeleteWindowByClass(WC_GRF_PARAMETERS);
|
|
|
new NewGRFParametersWindow(&_newgrf_parameters_desc, c);
|
|
|
}
|
|
|
|
|
|
/** Widgets of the #NewGRFTextfileWindow. */
|
|
|
enum ShowNewGRFTextfileWidgets {
|
|
|
GTW_WIDGET_CAPTION, ///< The caption of the window.
|
|
|
GTW_WIDGET_BACKGROUND, ///< Panel to draw the textfile on.
|
|
|
GTW_WIDGET_VSCROLLBAR, ///< Vertical scrollbar to scroll through the textfile up-and-down.
|
|
|
GTW_WIDGET_HSCROLLBAR, ///< Horizontal scrollbar to scroll through the textfile left-to-right.
|
|
|
};
|
|
|
|
|
|
/** Window for displaying the textfile of a NewGRF. */
|
|
|
struct NewGRFTextfileWindow : public Window, MissingGlyphSearcher {
|
|
|
const GRFConfig *grf_config; ///< View the textfile of this GRFConfig.
|
|
|
TextfileType file_type; ///< Type of textfile to view.
|
|
|
int line_height; ///< Height of a line in the display widget.
|
|
|
Scrollbar *vscroll; ///< Vertical scrollbar.
|
|
@@ -696,41 +674,12 @@ public:
|
|
|
DrawString(left + 2, right + 2, top, _grf_preset_list[this->result], sel ? TC_WHITE : TC_BLACK);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
static void NewGRFConfirmationCallback(Window *w, bool confirmed);
|
|
|
|
|
|
/** Names of the manage newgrfs window widgets. */
|
|
|
enum ShowNewGRFStateWidgets {
|
|
|
SNGRFS_PRESET_LIST,
|
|
|
SNGRFS_PRESET_SAVE,
|
|
|
SNGRFS_PRESET_DELETE,
|
|
|
SNGRFS_ADD,
|
|
|
SNGRFS_REMOVE,
|
|
|
SNGRFS_MOVE_UP,
|
|
|
SNGRFS_MOVE_DOWN,
|
|
|
SNGRFS_FILTER,
|
|
|
SNGRFS_FILE_LIST,
|
|
|
SNGRFS_SCROLLBAR,
|
|
|
SNGRFS_AVAIL_LIST,
|
|
|
SNGRFS_SCROLL2BAR,
|
|
|
SNGRFS_NEWGRF_INFO_TITLE,
|
|
|
SNGRFS_NEWGRF_INFO,
|
|
|
SNGRFS_OPEN_URL,
|
|
|
SNGRFS_NEWGRF_TEXTFILE,
|
|
|
SNGRFS_SET_PARAMETERS = SNGRFS_NEWGRF_TEXTFILE + TFT_END,
|
|
|
SNGRFS_TOGGLE_PALETTE,
|
|
|
SNGRFS_APPLY_CHANGES,
|
|
|
SNGRFS_RESCAN_FILES,
|
|
|
SNGRFS_RESCAN_FILES2,
|
|
|
SNGRFS_CONTENT_DOWNLOAD,
|
|
|
SNGRFS_CONTENT_DOWNLOAD2,
|
|
|
SNGRFS_SHOW_REMOVE, ///< Select active list buttons (0 = normal, 1 = simple layout).
|
|
|
SNGRFS_SHOW_APPLY, ///< Select display of the buttons below the 'details'.
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Window for showing NewGRF files
|
|
|
*/
|
|
|
struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
|
|
|
typedef GUIList<const GRFConfig *> GUIGRFConfigList;
|
|
|
|
|
@@ -1958,18 +1907,12 @@ static void NewGRFConfirmationCallback(W
|
|
|
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config)
|
|
|
{
|
|
|
DeleteWindowByClass(WC_GAME_OPTIONS);
|
|
|
new NewGRFWindow(&_newgrf_desc, editable, show_params, exec_changes, config);
|
|
|
}
|
|
|
|
|
|
/** The widgets for the scan progress. */
|
|
|
enum ScanProgressWindowWidgets {
|
|
|
SPWW_PROGRESS_BAR, ///< Simple progress bar.
|
|
|
GPWW_PROGRESS_TEXT, ///< Text explaining what is happening.
|
|
|
};
|
|
|
|
|
|
/** Widgets for the progress window. */
|
|
|
static const NWidgetPart _nested_scan_progress_widgets[] = {
|
|
|
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NEWGRF_SCAN_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY),
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20),
|
|
|
NWidget(NWID_VERTICAL), SetPIP(11, 8, 11),
|