Changeset - r19814:3650c08ee4d5
[Not reviewed]
master
0 5 0
frosch - 12 years ago 2012-11-27 21:35:52
frosch@openttd.org
(svn r24769) -Feature [FS#3852]: Add a string filter to the server list. (Eagle_rainbow)
5 files changed with 105 insertions and 43 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -208,24 +208,25 @@ STR_UNITS_WEIGHT_LONG_SI                
 
STR_UNITS_VOLUME_SHORT_METRIC                                   :{COMMA}l
 
STR_UNITS_VOLUME_SHORT_SI                                       :{COMMA}m³
 

	
 
STR_UNITS_VOLUME_LONG_METRIC                                    :{COMMA} litre{P "" s}
 
STR_UNITS_VOLUME_LONG_SI                                        :{COMMA} m³
 

	
 
STR_UNITS_FORCE_SI                                              :{COMMA} kN
 

	
 
STR_UNITS_HEIGHT_IMPERIAL                                       :{COMMA} ft
 
STR_UNITS_HEIGHT_SI                                             :{COMMA} m
 

	
 
# Common window strings
 
STR_LIST_FILTER_TITLE                                           :{BLACK}Filter string:
 
STR_LIST_FILTER_OSKTITLE                                        :{BLACK}Enter filter string
 
STR_LIST_FILTER_TOOLTIP                                         :{BLACK}Enter a keyword to filter the list for
 

	
 
STR_TOOLTIP_SORT_ORDER                                          :{BLACK}Select sorting order (descending/ascending)
 
STR_TOOLTIP_SORT_CRITERIA                                       :{BLACK}Select sorting criteria
 
STR_TOOLTIP_FILTER_CRITERIA                                     :{BLACK}Select filtering criteria
 
STR_BUTTON_SORT_BY                                              :{BLACK}Sort by
 
STR_BUTTON_LOCATION                                             :{BLACK}Location
 
STR_BUTTON_RENAME                                               :{BLACK}Rename
 

	
 
STR_TOOLTIP_CLOSE_WINDOW                                        :{BLACK}Close window
 
STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS                              :{BLACK}Window title - drag this to move window
src/network/network_gui.cpp
Show inline comments
 
@@ -28,24 +28,26 @@
 
#include "../querystring_gui.h"
 
#include "../sortlist_type.h"
 
#include "../company_func.h"
 
#include "../core/geometry_func.hpp"
 
#include "../genworld.h"
 
#include "../map_type.h"
 

	
 
#include "../widgets/network_widget.h"
 

	
 
#include "table/strings.h"
 
#include "../table/sprites.h"
 

	
 
#include "../stringfilter_type.h"
 

	
 

	
 
static void ShowNetworkStartServerWindow();
 
static void ShowNetworkLobbyWindow(NetworkGameList *ngl);
 

	
 
static const StringID _connection_types_dropdown[] = {
 
	STR_NETWORK_START_SERVER_LAN_INTERNET,
 
	STR_NETWORK_START_SERVER_INTERNET_ADVERTISE,
 
	INVALID_STRING_ID
 
};
 

	
 
static const StringID _lan_internet_types_dropdown[] = {
 
	STR_NETWORK_SERVER_LIST_LAN,
 
@@ -68,25 +70,25 @@ void SortNetworkLanguages()
 
}
 

	
 
/**
 
 * Update the network new window because a new server is
 
 * found on the network.
 
 * @param unselect unselect the currently selected item
 
 */
 
void UpdateNetworkGameWindow()
 
{
 
	InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME, 0);
 
}
 

	
 
typedef GUIList<NetworkGameList*> GUIGameServerList;
 
typedef GUIList<NetworkGameList*, StringFilter&> GUIGameServerList;
 
typedef uint16 ServerListPosition;
 
static const ServerListPosition SLP_INVALID = 0xFFFF;
 

	
 
/** Full blown container to make it behave exactly as we want :) */
 
class NWidgetServerListHeader : public NWidgetContainer {
 
	static const uint MINIMUM_NAME_WIDTH_BEFORE_NEW_HEADER = 150; ///< Minimum width before adding a new header
 
	bool visible[6]; ///< The visible headers
 
public:
 
	NWidgetServerListHeader() : NWidgetContainer(NWID_HORIZONTAL)
 
	{
 
		NWidgetLeaf *leaf = new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME_TOOLTIP);
 
		leaf->SetResize(1, 0);
 
@@ -207,50 +209,68 @@ public:
 
		assert((uint)(widget - WID_NG_NAME) < lengthof(this->visible));
 
		return this->visible[widget - WID_NG_NAME];
 
	}
 
};
 

	
 
class NetworkGameWindow : public Window {
 
protected:
 
	/* Runtime saved values */
 
	static Listing last_sorting;
 

	
 
	/* Constants for sorting servers */
 
	static GUIGameServerList::SortFunction * const sorter_funcs[];
 
	static GUIGameServerList::FilterFunction * const filter_funcs[];
 

	
 
	NetworkGameList *server;      ///< selected server
 
	NetworkGameList *last_joined; ///< the last joined server
 
	GUIGameServerList servers;    ///< list with game servers.
 
	ServerListPosition list_pos;  ///< position of the selected server
 
	Scrollbar *vscroll;
 
	Scrollbar *vscroll;           ///< vertical scrollbar of the list of servers
 
	QueryString name_editbox;     ///< Client name editbox.
 
	QueryString filter_editbox;   ///< Editbox for filter on servers
 

	
 
	/**
 
	 * (Re)build the network game list as its amount has changed because
 
	 * an item has been added or deleted for example
 
	 * (Re)build the GUI network game list (a.k.a. this->servers) as some
 
	 * major change has occurred. It ensures appropriate filtering and
 
	 * sorting, if both or either one is enabled.
 
	 */
 
	void BuildNetworkGameList()
 
	void BuildGUINetworkGameList()
 
	{
 
		if (!this->servers.NeedRebuild()) return;
 

	
 
		/* Create temporary array of games to use for listing */
 
		this->servers.Clear();
 

	
 
		for (NetworkGameList *ngl = _network_game_list; ngl != NULL; ngl = ngl->next) {
 
			*this->servers.Append() = ngl;
 
		}
 

	
 
		/* Apply the filter condition immediately, if a search string has been provided. */
 
		StringFilter sf;
 
		sf.SetFilterTerm(this->filter_editbox.text.buf);
 

	
 
		if (!sf.IsEmpty()) {
 
			this->servers.SetFilterState(true);
 
			this->servers.Filter(sf);
 
		} else {
 
			this->servers.SetFilterState(false);
 
		}
 

	
 
		this->servers.Compact();
 
		this->servers.RebuildDone();
 
		this->vscroll->SetCount(this->servers.Length());
 

	
 
		/* Sort the list of network games as requested. */
 
		this->servers.Sort();
 
		this->UpdateListPos();
 
	}
 

	
 
	/**
 
	 * Skip some of the 'garbage' in the string that we don't want to use
 
	 * to sort on. This way the alphabetical sorting will work better as
 
	 * we would be actually using those characters instead of some other
 
	 * characters such as spaces and tildes at the begin of the name.
 
	 * @param str The string to skip the initial garbage of.
 
	 * @return The string with the garbage skipped.
 
	 */
 
	static const char *SkipGarbage(const char *str)
 
	{
 
@@ -335,24 +355,34 @@ protected:
 
	/** Set this->list_pos to match this->server */
 
	void UpdateListPos()
 
	{
 
		this->list_pos = SLP_INVALID;
 
		for (uint i = 0; i != this->servers.Length(); i++) {
 
			if (this->servers[i] == this->server) {
 
				this->list_pos = i;
 
				break;
 
			}
 
		}
 
	}
 

	
 
	static bool CDECL NGameSearchFilter(NetworkGameList * const *item, StringFilter &sf)
 
	{
 
		assert(item != NULL);
 
		assert((*item) != NULL);
 

	
 
		sf.ResetState();
 
		sf.AddLine((*item)->info.server_name);
 
		return sf.GetState();
 
	}
 

	
 
	/**
 
	 * Draw a single server line.
 
	 * @param cur_item  the server to draw.
 
	 * @param y         from where to draw?
 
	 * @param highlight does the line need to be highlighted?
 
	 */
 
	void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight) const
 
	{
 
		const NWidgetBase *nwi_name = this->GetWidget<NWidgetBase>(WID_NG_NAME);
 
		const NWidgetBase *nwi_info = this->GetWidget<NWidgetBase>(WID_NG_INFO);
 

	
 
		/* show highlighted item with a different colour */
 
@@ -419,46 +449,49 @@ protected:
 
	 * If the server is below the currently displayed servers, it will
 
	 * scroll down an amount so that the server appears at the bottom.
 
	 * If the server is above the currently displayed servers, it will
 
	 * scroll up so that the server appears at the top.
 
	 */
 
	void ScrollToSelectedServer()
 
	{
 
		if (this->list_pos == SLP_INVALID) return; // no server selected
 
		this->vscroll->ScrollTowards(this->list_pos);
 
	}
 

	
 
public:
 
	NetworkGameWindow(const WindowDesc *desc) : name_editbox(NETWORK_CLIENT_NAME_LENGTH)
 
	NetworkGameWindow(const WindowDesc *desc) : name_editbox(NETWORK_CLIENT_NAME_LENGTH), filter_editbox(120)
 
	{
 
		this->list_pos = SLP_INVALID;
 
		this->server = NULL;
 

	
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR);
 
		this->FinishInitNested(desc, WN_NETWORK_WINDOW_GAME);
 

	
 
		this->querystrings[WID_NG_CLIENT] = &this->name_editbox;
 
		this->name_editbox.text.Assign(_settings_client.network.client_name);
 
		this->name_editbox.afilter = CS_ALPHANUMERAL;
 
		this->SetFocusedWidget(WID_NG_CLIENT);
 

	
 
		this->querystrings[WID_NG_FILTER] = &this->filter_editbox;
 
		this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR;
 
		this->SetFocusedWidget(WID_NG_FILTER);
 

	
 
		this->last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port));
 
		this->server = this->last_joined;
 
		if (this->last_joined != NULL) NetworkUDPQueryServer(this->last_joined->address);
 

	
 
		this->servers.SetListing(this->last_sorting);
 
		this->servers.SetSortFuncs(this->sorter_funcs);
 
		this->servers.SetFilterFuncs(this->filter_funcs);
 
		this->servers.ForceRebuild();
 
		this->SortNetworkGameList();
 
	}
 

	
 
	~NetworkGameWindow()
 
	{
 
		this->last_sorting = this->servers.GetListing();
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case WID_NG_CONN_BTN:
 
				SetDParam(0, _lan_internet_types_dropdown[_settings_client.network.lan_internet]);
 
@@ -552,25 +585,25 @@ public:
 
			case WID_NG_DATE:
 
			case WID_NG_YEARS:
 
			case WID_NG_INFO:
 
				if (widget - WID_NG_NAME == this->servers.SortType()) this->DrawSortButtonState(widget, this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
				break;
 
		}
 
	}
 

	
 

	
 
	virtual void OnPaint()
 
	{
 
		if (this->servers.NeedRebuild()) {
 
			this->BuildNetworkGameList();
 
			this->BuildGUINetworkGameList();
 
		}
 
		this->SortNetworkGameList();
 

	
 
		NetworkGameList *sel = this->server;
 
		/* 'Refresh' button invisible if no server selected */
 
		this->SetWidgetDisabledState(WID_NG_REFRESH, sel == NULL);
 
		/* 'Join' button disabling conditions */
 
		this->SetWidgetDisabledState(WID_NG_JOIN, sel == NULL || // no Selected Server
 
				!sel->online || // Server offline
 
				sel->info.clients_on >= sel->info.clients_max || // Server full
 
				!sel->info.compatible); // Revision mismatch
 

	
 
@@ -672,25 +705,25 @@ public:
 
				if (this->servers.SortType() == widget - WID_NG_NAME) {
 
					this->servers.ToggleSortOrder();
 
					if (this->list_pos != SLP_INVALID) this->list_pos = this->servers.Length() - this->list_pos - 1;
 
				} else {
 
					this->servers.SetSortType(widget - WID_NG_NAME);
 
					this->servers.ForceResort();
 
					this->SortNetworkGameList();
 
				}
 
				this->ScrollToSelectedServer();
 
				this->SetDirty();
 
				break;
 

	
 
			case WID_NG_MATRIX: { // Matrix to show networkgames
 
			case WID_NG_MATRIX: { // Show available network games
 
				uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NG_MATRIX);
 
				this->server = (id_v < this->servers.Length()) ? this->servers[id_v] : NULL;
 
				this->list_pos = (server == NULL) ? SLP_INVALID : id_v;
 
				this->SetDirty();
 

	
 
				/* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */
 
				if (click_count > 1 && !this->IsWidgetDisabled(WID_NG_JOIN)) this->OnClick(pt, WID_NG_JOIN, 1);
 
				break;
 
			}
 

	
 
			case WID_NG_LASTJOINED: {
 
				if (this->last_joined != NULL) {
 
@@ -829,24 +862,32 @@ public:
 
				if (this->server == this->last_joined) this->last_joined = NULL;
 
				this->server = NULL;
 
				this->list_pos = SLP_INVALID;
 
			}
 
		}
 

	
 
		return state;
 
	}
 

	
 
	virtual void OnEditboxChanged(int wid)
 
	{
 
		switch (wid) {
 
			case WID_NG_FILTER: {
 
				this->servers.ForceRebuild();
 
				this->BuildGUINetworkGameList();
 
				this->ScrollToSelectedServer();
 
				this->SetDirty();
 
				break;
 
			}
 

	
 
			case WID_NG_CLIENT:
 
				/* Make sure the name does not start with a space, so TAB completion works */
 
				if (!StrEmpty(this->name_editbox.text.buf) && this->name_editbox.text.buf[0] != ' ') {
 
					strecpy(_settings_client.network.client_name, this->name_editbox.text.buf, lastof(_settings_client.network.client_name));
 
				} else {
 
					strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name));
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
@@ -867,88 +908,102 @@ public:
 
};
 

	
 
Listing NetworkGameWindow::last_sorting = {false, 5};
 
GUIGameServerList::SortFunction * const NetworkGameWindow::sorter_funcs[] = {
 
	&NGameNameSorter,
 
	&NGameClientSorter,
 
	&NGameMapSizeSorter,
 
	&NGameDateSorter,
 
	&NGameYearsSorter,
 
	&NGameAllowedSorter
 
};
 

	
 
GUIGameServerList::FilterFunction * const NetworkGameWindow::filter_funcs[] = {
 
	&NGameSearchFilter
 
};
 

	
 
static NWidgetBase *MakeResizableHeader(int *biggest_index)
 
{
 
	*biggest_index = max<int>(*biggest_index, WID_NG_INFO);
 
	return new NWidgetServerListHeader();
 
}
 

	
 
static const NWidgetPart _nested_network_game_widgets[] = {
 
	/* TOP */
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
 
		NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_SERVER_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NG_MAIN),
 
		NWidget(NWID_VERTICAL), SetPIP(10, 7, 0),
 
			NWidget(NWID_HORIZONTAL), SetPIP(10, 7, 10),
 
				NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CONNECTION), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL),
 
				NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NG_CONN_BTN),
 
										SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP),
 
				NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
				NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CLIENT_LABEL), SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME, STR_NULL),
 
				NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, WID_NG_CLIENT), SetMinimalSize(151, 12),
 
										SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME_OSKTITLE, STR_NETWORK_SERVER_LIST_ENTER_NAME_TOOLTIP),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL), SetPIP(10, 7, 10),
 
				/* LEFT SIDE */
 
				NWidget(NWID_VERTICAL),
 
				NWidget(NWID_VERTICAL), SetPIP(0, 7, 0),
 
					NWidget(NWID_HORIZONTAL), SetPIP(0, 7, 0),
 
						NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CONNECTION), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL),
 
						NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NG_CONN_BTN),
 
											SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP),
 
						NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
					EndContainer(),
 
					NWidget(NWID_HORIZONTAL), SetPIP(0, 7, 0),
 
						NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_FILTER_LABEL), SetDataTip(STR_LIST_FILTER_TITLE, STR_NULL),
 
						NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, WID_NG_FILTER), SetMinimalSize(251, 12), SetFill(1, 0), SetResize(1, 0),
 
											SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
 
					EndContainer(),
 
					NWidget(NWID_HORIZONTAL),
 
						NWidget(NWID_VERTICAL),
 
							NWidgetFunction(MakeResizableHeader),
 
							NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, WID_NG_MATRIX), SetResize(1, 1), SetFill(1, 0),
 
												SetDataTip(0, STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT), SetScrollbar(WID_NG_SCROLLBAR),
 
						EndContainer(),
 
						NWidget(NWID_VSCROLLBAR, COLOUR_LIGHT_BLUE, WID_NG_SCROLLBAR),
 
					EndContainer(),
 
					NWidget(NWID_SPACER), SetMinimalSize(0, 7), SetResize(1, 0), SetFill(1, 1),
 
					NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_LASTJOINED_LABEL), SetFill(1, 0),
 
										SetDataTip(STR_NETWORK_SERVER_LIST_LAST_JOINED_SERVER, STR_NULL), SetResize(1, 0),
 
					NWidget(NWID_HORIZONTAL),
 
						NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NG_LASTJOINED), SetFill(1, 0), SetResize(1, 0),
 
											SetDataTip(0x0, STR_NETWORK_SERVER_LIST_CLICK_TO_SELECT_LAST),
 
					NWidget(NWID_VERTICAL),
 
						NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_LASTJOINED_LABEL), SetFill(1, 0),
 
											SetDataTip(STR_NETWORK_SERVER_LIST_LAST_JOINED_SERVER, STR_NULL), SetResize(1, 0),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NG_LASTJOINED), SetFill(1, 0), SetResize(1, 0),
 
												SetDataTip(0x0, STR_NETWORK_SERVER_LIST_CLICK_TO_SELECT_LAST),
 
							EndContainer(),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NG_LASTJOINED_SPACER), SetFill(0, 0),
 
						EndContainer(),
 
						NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NG_LASTJOINED_SPACER), SetFill(0, 0),
 
					EndContainer(),
 
				EndContainer(),
 
				/* RIGHT SIDE */
 
				NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NG_DETAILS),
 
					NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(5, 5, 5),
 
						NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NG_DETAILS_SPACER), SetMinimalSize(140, 155), SetResize(0, 1), SetFill(1, 1), // Make sure it's at least this wide
 
						NWidget(NWID_HORIZONTAL, NC_NONE), SetPIP(5, 5, 5),
 
							NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NG_NEWGRF_MISSING_SEL),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_NEWGRF_MISSING), SetFill(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP),
 
								NWidget(NWID_SPACER), SetFill(1, 0),
 
				NWidget(NWID_VERTICAL), SetPIP(0, 7, 0),
 
					NWidget(NWID_HORIZONTAL), SetPIP(0, 7, 0),
 
						NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CLIENT_LABEL), SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME, STR_NULL),
 
						NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, WID_NG_CLIENT), SetMinimalSize(151, 12), SetFill(1, 0), SetResize(1, 0),
 
											SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME_OSKTITLE, STR_NETWORK_SERVER_LIST_ENTER_NAME_TOOLTIP),
 
					EndContainer(),
 
					NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_NG_DETAILS),
 
						NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(5, 5, 5),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NG_DETAILS_SPACER), SetMinimalSize(140, 155), SetResize(0, 1), SetFill(1, 1), // Make sure it's at least this wide
 
							NWidget(NWID_HORIZONTAL, NC_NONE), SetPIP(5, 5, 5),
 
								NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NG_NEWGRF_MISSING_SEL),
 
									NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_NEWGRF_MISSING), SetFill(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP),
 
									NWidget(NWID_SPACER), SetFill(1, 0),
 
								EndContainer(),
 
							EndContainer(),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 5, 5),
 
							NWidget(NWID_SPACER), SetFill(1, 0),
 
							NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NG_NEWGRF_SEL),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_NEWGRF), SetFill(1, 0), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL),
 
							NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 5, 5),
 
								NWidget(NWID_SPACER), SetFill(1, 0),
 
								NWidget(NWID_SELECTION, INVALID_COLOUR, WID_NG_NEWGRF_SEL),
 
									NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_NEWGRF), SetFill(1, 0), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL),
 
									NWidget(NWID_SPACER), SetFill(1, 0),
 
								EndContainer(),
 
							EndContainer(),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 5, 5),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_JOIN), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_JOIN_GAME, STR_NULL),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_REFRESH), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP),
 
							NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 5, 5),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_JOIN), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_JOIN_GAME, STR_NULL),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_REFRESH), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP),
 
							EndContainer(),
 
						EndContainer(),
 
					EndContainer(),
 
				EndContainer(),
 
			EndContainer(),
 
			/* BOTTOM */
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(NWID_VERTICAL),
 
					NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 7, 4),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_FIND), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_FIND_SERVER, STR_NETWORK_SERVER_LIST_FIND_SERVER_TOOLTIP),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_ADD), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_ADD_SERVER, STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_START), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_START_SERVER, STR_NETWORK_SERVER_LIST_START_SERVER_TOOLTIP),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
src/script/api/game/game_window.hpp.sq
Show inline comments
 
@@ -653,24 +653,26 @@ void SQGSWindow_Register(Squirrel *engin
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_SELECT_ALL,                        "WID_NCL_SELECT_ALL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_SELECT_UPDATE,                     "WID_NCL_SELECT_UPDATE");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_UNSELECT,                          "WID_NCL_UNSELECT");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_OPEN_URL,                          "WID_NCL_OPEN_URL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_CANCEL,                            "WID_NCL_CANCEL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_DOWNLOAD,                          "WID_NCL_DOWNLOAD");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_SEL_ALL_UPDATE,                    "WID_NCL_SEL_ALL_UPDATE");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_MAIN,                               "WID_NG_MAIN");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CONNECTION,                         "WID_NG_CONNECTION");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CONN_BTN,                           "WID_NG_CONN_BTN");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CLIENT_LABEL,                       "WID_NG_CLIENT_LABEL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CLIENT,                             "WID_NG_CLIENT");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_FILTER_LABEL,                       "WID_NG_FILTER_LABEL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_FILTER,                             "WID_NG_FILTER");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_HEADER,                             "WID_NG_HEADER");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_NAME,                               "WID_NG_NAME");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CLIENTS,                            "WID_NG_CLIENTS");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_MAPSIZE,                            "WID_NG_MAPSIZE");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_DATE,                               "WID_NG_DATE");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_YEARS,                              "WID_NG_YEARS");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_INFO,                               "WID_NG_INFO");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_MATRIX,                             "WID_NG_MATRIX");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_SCROLLBAR,                          "WID_NG_SCROLLBAR");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_LASTJOINED_LABEL,                   "WID_NG_LASTJOINED_LABEL");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_LASTJOINED,                         "WID_NG_LASTJOINED");
 
	SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_LASTJOINED_SPACER,                  "WID_NG_LASTJOINED_SPACER");
src/script/api/script_window.hpp
Show inline comments
 
@@ -1617,24 +1617,26 @@ public:
 
		WID_NCL_SEL_ALL_UPDATE                       = ::WID_NCL_SEL_ALL_UPDATE,                       ///< #NWID_SELECTION widget for select all/update buttons..
 
	};
 

	
 
	/* automatically generated from ../../widgets/network_widget.h */
 
	/** Widgets of the #NetworkGameWindow class. */
 
	enum NetworkGameWidgets {
 
		WID_NG_MAIN                                  = ::WID_NG_MAIN,                                  ///< Main panel.
 

	
 
		WID_NG_CONNECTION                            = ::WID_NG_CONNECTION,                            ///< Label in front of connection droplist.
 
		WID_NG_CONN_BTN                              = ::WID_NG_CONN_BTN,                              ///< 'Connection' droplist button.
 
		WID_NG_CLIENT_LABEL                          = ::WID_NG_CLIENT_LABEL,                          ///< Label in front of client name edit box.
 
		WID_NG_CLIENT                                = ::WID_NG_CLIENT,                                ///< Panel with editbox to set client name.
 
		WID_NG_FILTER_LABEL                          = ::WID_NG_FILTER_LABEL,                          ///< Label in front of the filter/search edit box.
 
		WID_NG_FILTER                                = ::WID_NG_FILTER,                                ///< Panel with the edit box to enter the search text.
 

	
 
		WID_NG_HEADER                                = ::WID_NG_HEADER,                                ///< Header container of the matrix.
 
		WID_NG_NAME                                  = ::WID_NG_NAME,                                  ///< 'Name' button.
 
		WID_NG_CLIENTS                               = ::WID_NG_CLIENTS,                               ///< 'Clients' button.
 
		WID_NG_MAPSIZE                               = ::WID_NG_MAPSIZE,                               ///< 'Map size' button.
 
		WID_NG_DATE                                  = ::WID_NG_DATE,                                  ///< 'Date' button.
 
		WID_NG_YEARS                                 = ::WID_NG_YEARS,                                 ///< 'Years' button.
 
		WID_NG_INFO                                  = ::WID_NG_INFO,                                  ///< Third button in the game list panel.
 

	
 
		WID_NG_MATRIX                                = ::WID_NG_MATRIX,                                ///< Panel with list of games.
 
		WID_NG_SCROLLBAR                             = ::WID_NG_SCROLLBAR,                             ///< Scrollbar of matrix.
 

	
src/widgets/network_widget.h
Show inline comments
 
@@ -11,24 +11,26 @@
 

	
 
#ifndef WIDGETS_NETWORK_WIDGET_H
 
#define WIDGETS_NETWORK_WIDGET_H
 

	
 
/** Widgets of the #NetworkGameWindow class. */
 
enum NetworkGameWidgets {
 
	WID_NG_MAIN,               ///< Main panel.
 

	
 
	WID_NG_CONNECTION,         ///< Label in front of connection droplist.
 
	WID_NG_CONN_BTN,           ///< 'Connection' droplist button.
 
	WID_NG_CLIENT_LABEL,       ///< Label in front of client name edit box.
 
	WID_NG_CLIENT,             ///< Panel with editbox to set client name.
 
	WID_NG_FILTER_LABEL,       ///< Label in front of the filter/search edit box.
 
	WID_NG_FILTER,             ///< Panel with the edit box to enter the search text.
 

	
 
	WID_NG_HEADER,             ///< Header container of the matrix.
 
	WID_NG_NAME,               ///< 'Name' button.
 
	WID_NG_CLIENTS,            ///< 'Clients' button.
 
	WID_NG_MAPSIZE,            ///< 'Map size' button.
 
	WID_NG_DATE,               ///< 'Date' button.
 
	WID_NG_YEARS,              ///< 'Years' button.
 
	WID_NG_INFO,               ///< Third button in the game list panel.
 

	
 
	WID_NG_MATRIX,             ///< Panel with list of games.
 
	WID_NG_SCROLLBAR,          ///< Scrollbar of matrix.
 

	
0 comments (0 inline, 0 general)