src/network/newgrf_download.cpp
author Tero Marttila <terom@fixme.fi>
Fri, 18 Jul 2008 21:16:18 +0300
changeset 11174 b29402c54ffe
child 11175 020c61e39c94
permissions -rw-r--r--
create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
11174
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
/* $Id$ */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
/** @file newgrf_download.cpp GUI to download NewGRFs. */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
#include "../stdafx.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
#include "../openttd.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
#include "../strings_func.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     7
#include "../date_func.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
#include "../gui.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
#include "../window_gui.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
#include "../textbuf_gui.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
#include "../variables.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
#include "../newgrf.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
#include "newgrf_download.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
#include "../functions.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
#include "../window_func.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
#include "../core/alloc_func.hpp"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
#include "../string_func.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
#include "../gfx_func.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
#include "../querystring_gui.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
#include "../sortlist_type.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
#include "table/strings.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
#include "../table/sprites.h"
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
// XXX: copy-pasted from newgrf_gui.cpp
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26
static void ShowDownloadNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, uint bottom, bool show_params)
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    27
{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
	char buff[256];
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    29
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    30
	if (c->error != NULL) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    31
		char message[512];
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    32
		if (c->error->custom_message == NULL) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    33
			SetDParamStr(0, c->filename);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    34
			SetDParamStr(1, c->error->data);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    35
			for (uint i = 0; i < c->error->num_params; i++) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    36
				uint32 param = 0;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    37
				byte param_number = c->error->param_number[i];
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    38
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    39
				if (param_number < c->num_params) param = c->param[param_number];
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    40
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    41
				SetDParam(2 + i, param);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    42
			}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    43
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    44
			GetString(message, c->error->message, lastof(message));
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    45
		} else {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    46
			SetDParamStr(0, c->error->custom_message);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    47
			GetString(message, STR_JUST_RAW_STRING, lastof(message));
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    48
		}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    49
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    50
		SetDParamStr(0, message);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    51
		y += DrawStringMultiLine(x, y, c->error->severity, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    52
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    53
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    54
	/* Draw filename or not if it is not known (GRF sent over internet) */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    55
	if (c->filename != NULL) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    56
		SetDParamStr(0, c->filename);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    57
		y += DrawStringMultiLine(x, y, STR_NEWGRF_FILENAME, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    58
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    59
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    60
	/* Prepare and draw GRF ID */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    61
	snprintf(buff, lengthof(buff), "%08X", BSWAP32(c->grfid));
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    62
	SetDParamStr(0, buff);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    63
	y += DrawStringMultiLine(x, y, STR_NEWGRF_GRF_ID, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    64
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    65
	/* Prepare and draw MD5 sum */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    66
	md5sumToString(buff, lastof(buff), c->md5sum);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    67
	SetDParamStr(0, buff);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    68
	y += DrawStringMultiLine(x, y, STR_NEWGRF_MD5SUM, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    69
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    70
	/* Show GRF parameter list */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    71
	if (show_params) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    72
		if (c->num_params > 0) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    73
			GRFBuildParamList(buff, c, lastof(buff));
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    74
			SetDParam(0, STR_JUST_RAW_STRING);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    75
			SetDParamStr(1, buff);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    76
		} else {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    77
			SetDParam(0, STR_01A9_NONE);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    78
		}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    79
		y += DrawStringMultiLine(x, y, STR_NEWGRF_PARAMETER, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    80
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    81
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    82
	/* Show flags */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    83
	if (c->status == GCS_NOT_FOUND)        y += DrawStringMultiLine(x, y, STR_NEWGRF_NOT_FOUND, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    84
	if (c->status == GCS_DISABLED)         y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    85
	if (HasBit(c->flags, GCF_COMPATIBLE)) y += DrawStringMultiLine(x, y, STR_NEWGRF_COMPATIBLE_LOADED, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    86
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    87
	/* Draw GRF info if it exists */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    88
	if (c->info != NULL && !StrEmpty(c->info)) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    89
		SetDParam(0, STR_JUST_RAW_STRING);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    90
		SetDParamStr(1, c->info);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    91
		y += DrawStringMultiLine(x, y, STR_02BD, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    92
	} else {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    93
		y += DrawStringMultiLine(x, y, STR_NEWGRF_NO_INFO, w, bottom - y);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    94
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    95
}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    96
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    97
/**
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    98
 * Window for downloading NewGRF files
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    99
 */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   100
struct NewGRFDownloadWindow : public Window {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   101
	/* Names of the add a newgrf window widgets */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   102
	enum DownloadNewGRFWindowWidgets {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   103
        DNGRFS_CLOSEBOX = 0,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   104
		DNGRFS_CAPTION,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   105
		DNGRFS_BACKGROUND,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   106
		DNGRFS_FILE_LIST,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   107
		DNGRFS_SCROLLBAR,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   108
		DNGRFS_NEWGRF_INFO,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   109
		DNGRFS_CHECK_AVAILABLE,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   110
		DNGRFS_DOWNLOAD_AVAILABLE,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   111
		DNGRFS_RESIZE,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   112
	};
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   113
    
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   114
    // XXX: do we need a temp. copy? I think not
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   115
	GRFConfig *list;       ///< temporary grf list to which changes are made
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   116
	const GRFConfig *sel;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   117
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   118
	NewGRFDownloadWindow(const WindowDesc *desc, GRFConfig **list) : Window(desc, 0)
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   119
	{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   120
        // resize magic
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   121
		this->resize.step_height = 14;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   122
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   123
        // the list of GRFs
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   124
		CopyGRFConfigList(&this->list, *list, false);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   125
        
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   126
        // display window?
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   127
		this->FindWindowPlacementAndResize(desc);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   128
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   129
        // set up our own state
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   130
		this->SetupDownloadNewGRFWindow();
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   131
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   132
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   133
	~NewGRFDownloadWindow()
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   134
	{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   135
		/* Remove the temporary copy of grf-list used in window */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   136
		ClearGRFConfigList(&this->list);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   137
    }
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   138
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   139
    void SetupDownloadNewGRFWindow()
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   140
	{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   141
		const GRFConfig *c;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   142
		int i;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   143
        
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   144
        // count how many NewGRFs in our list
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   145
		for (c = this->list, i = 0; c != NULL; c = c->next, i++) {}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   146
        
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   147
        // something to do with vertical scrolling...
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   148
		this->vscroll.cap = (this->widget[DNGRFS_FILE_LIST].bottom - this->widget[DNGRFS_FILE_LIST].top) / 14 + 1;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   149
		SetVScrollCount(this, i);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   150
        
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   151
        // disable the "Check Available" button if there are no incompatible NewGRFs
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   152
		this->SetWidgetDisabledState(DNGRFS_CHECK_AVAILABLE, (i == 0));
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   153
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   154
        // disable the "Download Available" button until we've checked for available NewGRFs
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   155
		this->SetWidgetDisabledState(DNGRFS_DOWNLOAD_AVAILABLE, 1);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   156
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   157
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   158
    virtual void OnPaint()
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   159
	{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   160
        // superclass widget-drawing
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   161
		this->DrawWidgets();
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   162
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   163
		/* Draw the NewGRF file list */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   164
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   165
		int y = this->widget[DNGRFS_FILE_LIST].top;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   166
		int i = 0;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   167
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   168
        // for each GRF...
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   169
		for (const GRFConfig *c = this->list; c != NULL; c = c->next, i++) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   170
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   171
            // is scrolled into view
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   172
			if (i >= this->vscroll.pos && i < this->vscroll.pos + this->vscroll.cap) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   173
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   174
				SpriteID pal;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   175
				byte txtoffset;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   176
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   177
                // the NewGRF name
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   178
				const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   179
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   180
				/* Pick a colour */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   181
				switch (c->status) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   182
					case GCS_NOT_FOUND:
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   183
					case GCS_DISABLED:
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   184
						pal = PALETTE_TO_RED;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   185
						break;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   186
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   187
                    // XXX: green if downloadable
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   188
					case GCS_ACTIVATED:
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   189
						pal = PALETTE_TO_GREEN;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   190
						break;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   191
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   192
					default:
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   193
						pal = PALETTE_TO_BLUE;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   194
						break;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   195
				}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   196
                
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   197
                // XXX: more colour logic that must be fixed...
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   198
				if (pal != PALETTE_TO_RED) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   199
					if (HasBit(c->flags, GCF_STATIC)) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   200
						pal = PALETTE_TO_GREY;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   201
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   202
					} else if (HasBit(c->flags, GCF_COMPATIBLE)) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   203
						pal = PALETTE_TO_ORANGE;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   204
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   205
					}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   206
				}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   207
                
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   208
                // draw the square in the chosen colour
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   209
				DrawSprite(SPR_SQUARE, pal, 5, y + 2);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   210
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   211
                // XXX: hmm... use for download errors?
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   212
				if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, 20, y + 2);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   213
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   214
                // where to draw the text
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   215
				txtoffset = c->error != NULL ? 35 : 25;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   216
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   217
                // draw the chosen text (GRF name/filename)
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   218
				DoDrawStringTruncated(text, txtoffset, y + 3, this->sel == c ? TC_WHITE : TC_BLACK, this->width - txtoffset - 10);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   219
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   220
                // advance on to the next row
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   221
				y += 14;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   222
			}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   223
		}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   224
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   225
		if (this->sel != NULL) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   226
			/* Draw NewGRF file info */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   227
			const Widget *wi = &this->widget[DNGRFS_NEWGRF_INFO];
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   228
    
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   229
			ShowDownloadNewGRFInfo(this->sel, wi->left + 2, wi->top + 2, wi->right - wi->left - 2, wi->bottom, false);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   230
		}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   231
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   232
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   233
	virtual void OnClick(Point pt, int widget)
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   234
	{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   235
		switch (widget) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   236
            case DNGRFS_CHECK_AVAILABLE:
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   237
                // XXX: implement
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   238
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   239
                break;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   240
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   241
            case DNGRFS_DOWNLOAD_AVAILABLE:
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   242
                // XXX: implement
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   243
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   244
                break;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   245
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   246
			case DNGRFS_FILE_LIST: { // Select a GRF
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   247
				GRFConfig *c;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   248
				uint i = (pt.y - this->widget[DNGRFS_FILE_LIST].top) / 14 + this->vscroll.pos;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   249
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   250
				for (c = this->list; c != NULL && i > 0; c = c->next, i--) {}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   251
				this->sel = c;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   252
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   253
				this->SetDirty();
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   254
				break;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   255
			}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   256
		}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   257
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   258
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   259
    virtual void OnResize(Point new_size, Point delta)
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   260
	{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   261
		if (delta.x != 0) {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   262
			ResizeButtons(this, DNGRFS_CHECK_AVAILABLE, DNGRFS_DOWNLOAD_AVAILABLE);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   263
		}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   264
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   265
		this->vscroll.cap += delta.y / 14;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   266
		this->widget[DNGRFS_FILE_LIST].data = (this->vscroll.cap << 8) + 1;
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   267
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   268
		this->SetupDownloadNewGRFWindow();
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   269
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   270
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   271
	virtual void OnInvalidateData(int data = 0)
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   272
	{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   273
		this->SetupDownloadNewGRFWindow();
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   274
	}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   275
};
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   276
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   277
/* Widget definition of the download newgrfs window */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   278
static const Widget _newgrf_download_widgets[] = {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   279
{   WWT_CLOSEBOX,  RESIZE_NONE, 10,   0,  10,   0,  13, STR_00C5,                    STR_018B_CLOSE_WINDOW },            // DNGRFS_CLOSEBOX
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   280
{    WWT_CAPTION, RESIZE_RIGHT, 10,  11, 299,   0,  13, STR_NEWGRF_SETTINGS_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS },  // DNGRFS_CAPTION
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   281
{      WWT_PANEL, RESIZE_RIGHT, 10,   0, 299,  14,  29, STR_NULL,                    STR_NULL },                         // DNGRFS_BACKGROUND
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   282
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   283
    /*
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   284
{ WWT_PUSHTXTBTN,  RESIZE_NONE,  3,  10,  79,  16,  27, STR_NEWGRF_ADD,              STR_NEWGRF_ADD_TIP },               // SNGRFS_ADD
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   285
{ WWT_PUSHTXTBTN,  RESIZE_NONE,  3,  80, 149,  16,  27, STR_NEWGRF_REMOVE,           STR_NEWGRF_REMOVE_TIP },            // SNGRFS_REMOVE
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   286
{ WWT_PUSHTXTBTN,  RESIZE_NONE,  3, 150, 219,  16,  27, STR_NEWGRF_MOVEUP,           STR_NEWGRF_MOVEUP_TIP },            // SNGRFS_MOVE_UP
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   287
{ WWT_PUSHTXTBTN, RESIZE_RIGHT,  3, 220, 289,  16,  27, STR_NEWGRF_MOVEDOWN,         STR_NEWGRF_MOVEDOWN_TIP },          // SNGRFS_MOVE_DOWN
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   288
    */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   289
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   290
{     WWT_MATRIX,    RESIZE_RB, 10,   0, 287,  30,  99, 0x501,                       STR_NEWGRF_DOWNLOAD_LIST_TIP },     // DNGRFS_FILE_LIST
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   291
{  WWT_SCROLLBAR,   RESIZE_LRB, 10, 288, 299,  30,  99, 0x0,                         STR_0190_SCROLL_BAR_SCROLLS_LIST }, // DNGRFS_SCROLLBAR
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   292
{      WWT_PANEL,   RESIZE_RTB, 10,   0, 299, 100, 212, STR_NULL,                    STR_NULL },                         // DNGRFS_NEWGRF_INFO
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   293
{ WWT_PUSHTXTBTN,    RESIZE_TB, 10,   0, 143, 213, 224, STR_NEWGRF_CHECK_AVAILABLE,  STR_NULL },                         // DNGRFS_CHECK_AVILABLE
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   294
{ WWT_PUSHTXTBTN,   RESIZE_RTB, 10, 144, 287, 213, 224, STR_NEWGRF_DOWNLOAD_AVAILABLE,  STR_NULL },                      // DNGRFS_DOWNLOAD_AVAILABLE
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   295
{  WWT_RESIZEBOX,  RESIZE_LRTB, 10, 288, 299, 213, 224, 0x0,                         STR_RESIZE_BUTTON },                // DNGRFS_RESIZE
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   296
{ WIDGETS_END },
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   297
};
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   298
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   299
/* Window definition of the manage newgrfs window */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   300
static const WindowDesc _newgrf_download_desc = {
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   301
	WDP_CENTER, WDP_CENTER, 300, 225, 300, 225,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   302
	WC_GAME_OPTIONS, WC_NONE,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   303
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   304
	_newgrf_download_widgets,
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   305
};
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   306
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   307
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   308
/** Setup the NewGRF download gui
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   309
 * @param config pointer to a linked-list of grfconfig's needed */
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   310
void ShowNewGRFDownload(GRFConfig **config)
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   311
{
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   312
	DeleteWindowByClass(WC_GAME_OPTIONS);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   313
	new NewGRFDownloadWindow(&_newgrf_download_desc, config);
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   314
}
b29402c54ffe create the newgrf download GUI (mostly by copy-pasting from newgrf_gui.cpp) - compiles, needs testing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   315