GUI to change NewGRF settings. More...
#include "stdafx.h"#include "error.h"#include "gui.h"#include "newgrf.h"#include "strings_func.h"#include "window_func.h"#include "gamelog.h"#include "settings_type.h"#include "settings_func.h"#include "widgets/dropdown_type.h"#include "network/network.h"#include "network/network_content.h"#include "sortlist_type.h"#include "querystring_gui.h"#include "core/geometry_func.hpp"#include "newgrf_text.h"#include "textfile_gui.h"#include "widgets/newgrf_widget.h"#include "widgets/misc_widget.h"#include "table/sprites.h"Go to the source code of this file.
Data Structures | |
| struct | NewGRFParametersWindow |
| Window for setting the parameters of a NewGRF. More... | |
| struct | NewGRFTextfileWindow |
| Window for displaying the textfile of a NewGRF. More... | |
| class | DropDownListPresetItem |
| struct | NewGRFWindow |
| Window for showing NewGRF files. More... | |
| class | NWidgetNewGRFDisplay |
| Custom nested widget container for the NewGRF gui. More... | |
| struct | ScanProgressWindow |
| Window for showing the progress of NewGRF scanning. More... | |
Functions | |
| void | ShowNewGRFError () |
| Show the first NewGRF error we can find. | |
| static void | ShowNewGRFInfo (const GRFConfig *c, uint x, uint y, uint right, uint bottom, bool show_params) |
| static void | OpenGRFParameterWindow (GRFConfig *c, bool editable) |
| void | ShowNewGRFTextfileWindow (TextfileType file_type, const GRFConfig *c) |
| static void | NewGRFConfirmationCallback (Window *w, bool confirmed) |
| Callback function for the newgrf 'apply changes' confirmation window. | |
| void | ShowMissingContentWindow (const GRFConfig *list) |
| Show the content list window with all missing grfs from the given list. | |
| NWidgetBase * | NewGRFDisplay (int *biggest_index) |
| Construct nested container widget for managing the lists and the info panel of the NewGRF GUI. | |
| void | ShowNewGRFSettings (bool editable, bool show_params, bool exec_changes, GRFConfig **config) |
| Setup the NewGRF gui. | |
| void | UpdateNewGRFScanStatus (uint num, const char *name) |
| Update the NewGRF scan status. | |
Variables | |
| static const NWidgetPart | _nested_newgrf_parameter_widgets [] |
| static const WindowDesc | _newgrf_parameters_desc (WDP_CENTER, 500, 208, WC_GRF_PARAMETERS, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_newgrf_parameter_widgets, lengthof(_nested_newgrf_parameter_widgets)) |
| Window definition for the change grf parameters window. | |
| static GRFPresetList | _grf_preset_list |
| static const NWidgetPart | _nested_newgrf_actives_widgets [] |
| static const NWidgetPart | _nested_newgrf_availables_widgets [] |
| static const NWidgetPart | _nested_newgrf_infopanel_widgets [] |
| static const NWidgetPart | _nested_newgrf_widgets [] |
| static const WindowDesc | _newgrf_desc (WDP_CENTER, 300, 263, WC_GAME_OPTIONS, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_newgrf_widgets, lengthof(_nested_newgrf_widgets)) |
| static const NWidgetPart | _nested_scan_progress_widgets [] |
| Widgets for the progress window. | |
| static const WindowDesc | _scan_progress_desc (WDP_CENTER, 0, 0, WC_MODAL_PROGRESS, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_scan_progress_widgets, lengthof(_nested_scan_progress_widgets)) |
| Description of the widgets and other settings of the window. | |
GUI to change NewGRF settings.
Definition in file newgrf_gui.cpp.
| static void NewGRFConfirmationCallback | ( | Window * | w, | |
| bool | confirmed | |||
| ) | [static] |
Callback function for the newgrf 'apply changes' confirmation window.
| w | Window which is calling this callback | |
| confirmed | boolean value, true when yes was clicked, false otherwise |
Definition at line 1708 of file newgrf_gui.cpp.
References _grfconfig, NewGRFWindow::active_sel, NewGRFWindow::actives, NewGRFWindow::avails, CopyGRFConfigList(), DeleteWindowByClass(), GamelogGRFUpdate(), GamelogStartAction(), GamelogStopAction(), GLAT_GRF, Window::InvalidateData(), GRFConfig::next, NewGRFWindow::orig_list, ReInitAllWindows(), ReloadNewGRFData(), WC_BUILD_OBJECT, and WC_GRF_PARAMETERS.
| NWidgetBase* NewGRFDisplay | ( | int * | biggest_index | ) |
Construct nested container widget for managing the lists and the info panel of the NewGRF GUI.
Definition at line 1665 of file newgrf_gui.cpp.
References lengthof, MakeNWidgets(), and max().
| void ShowMissingContentWindow | ( | const GRFConfig * | list | ) |
Show the content list window with all missing grfs from the given list.
| list | The list of grfs to check for missings / not exactly matching ones. |
Definition at line 1298 of file newgrf_gui.cpp.
References SmallVector< T, S >::Append(), BSWAP32(), GRFConfig::flags, GCF_COMPATIBLE, GCS_NOT_FOUND, GRFConfig::GetName(), GRFIdentifier::grfid, HasBit(), GRFConfig::ident, SmallVector< T, S >::Length(), lengthof, GRFIdentifier::md5sum, ContentInfo::md5sum, ContentInfo::name, GRFConfig::next, GRFConfig::original_md5sum, ShowNetworkContentListWindow(), ContentInfo::state, GRFConfig::status, ttd_strlcpy(), ContentInfo::type, and ContentInfo::unique_id.
| void ShowNewGRFSettings | ( | bool | editable, | |
| bool | show_params, | |||
| bool | exec_changes, | |||
| GRFConfig ** | config | |||
| ) |
Setup the NewGRF gui.
| editable | allow the user to make changes to the grfconfig in the window | |
| show_params | show information about what parameters are set for the grf files | |
| exec_changes | if changes are made to the list (editable is true), apply these changes immediately or only update the list | |
| config | pointer to a linked-list of grfconfig's that will be shown |
Definition at line 1746 of file newgrf_gui.cpp.
References DeleteWindowByClass(), and WC_GAME_OPTIONS.
Referenced by MenuClickSettings(), and SelectGameWindow::OnClick().
| void UpdateNewGRFScanStatus | ( | uint | num, | |
| const char * | name | |||
| ) |
Update the NewGRF scan status.
| num | The number of NewGRFs scanned so far. | |
| name | The name of the last scanned NewGRF. |
Definition at line 1864 of file newgrf_gui.cpp.
References FindWindowByClass(), ScanProgressWindow::UpdateNewGRFScanStatus(), and WC_MODAL_PROGRESS.
Referenced by GRFFileScanner::AddFile(), and ScanNewGRFFiles().
const NWidgetPart _nested_newgrf_parameter_widgets[] [static] |
{
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_PARAMETERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NP_SHOW_NUMPAR),
NWidget(WWT_PANEL, COLOUR_MAUVE), SetResize(1, 0), SetFill(1, 0), SetPIP(4, 0, 4),
NWidget(NWID_HORIZONTAL), SetPIP(4, 0, 4),
NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_NP_NUMPAR_DEC), SetMinimalSize(12, 12), SetDataTip(AWV_DECREASE, STR_NULL),
NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_NP_NUMPAR_INC), SetMinimalSize(12, 12), SetDataTip(AWV_INCREASE, STR_NULL),
NWidget(WWT_TEXT, COLOUR_MAUVE, WID_NP_NUMPAR), SetResize(1, 0), SetFill(1, 0), SetPadding(0, 0, 0, 4), SetDataTip(STR_NEWGRF_PARAMETERS_NUM_PARAM, STR_NULL),
EndContainer(),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_NP_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(WID_NP_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_NP_SCROLLBAR),
EndContainer(),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NP_SHOW_DESCRIPTION),
NWidget(WWT_PANEL, COLOUR_MAUVE, WID_NP_DESCRIPTION), SetResize(1, 0), SetFill(1, 0),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_NP_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NEWGRF_PARAMETERS_CLOSE, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_NP_RESET), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NEWGRF_PARAMETERS_RESET, STR_NEWGRF_PARAMETERS_RESET_TOOLTIP),
EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
EndContainer(),
}
Definition at line 422 of file newgrf_gui.cpp.
const NWidgetPart _nested_newgrf_widgets[] [static] |
{
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_SETTINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_MAUVE),
NWidgetFunction(NewGRFDisplay), SetPadding(WD_RESIZEBOX_WIDTH, WD_RESIZEBOX_WIDTH, 2, WD_RESIZEBOX_WIDTH),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
EndContainer(),
EndContainer(),
}
Definition at line 1680 of file newgrf_gui.cpp.
const NWidgetPart _nested_scan_progress_widgets[] [static] |
{
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),
NWidget(WWT_LABEL, INVALID_COLOUR), SetDataTip(STR_NEWGRF_SCAN_MESSAGE, STR_NULL), SetFill(1, 0),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SP_PROGRESS_BAR), SetFill(1, 0),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SP_PROGRESS_TEXT), SetFill(1, 0),
EndContainer(),
EndContainer(),
EndContainer(),
}
Widgets for the progress window.
Definition at line 1753 of file newgrf_gui.cpp.
const WindowDesc _scan_progress_desc(WDP_CENTER, 0, 0, WC_MODAL_PROGRESS, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_scan_progress_widgets, lengthof(_nested_scan_progress_widgets)) [static] |
Description of the widgets and other settings of the window.
Referenced by ScanProgressWindow::ScanProgressWindow().
1.7.1