author | Tero Marttila <terom@fixme.fi> |
Tue, 22 Jul 2008 23:20:33 +0300 | |
changeset 11184 | 88c967f1422b |
parent 11161 | 7d0fac8f14cd |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10399
diff
changeset
|
3 |
/** @file misc_gui.cpp GUIs for a number of misc windows. */ |
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6523
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1879
diff
changeset
|
6 |
#include "openttd.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
7 |
#include "heightmap.h" |
1299
0a6510cc889b
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1274
diff
changeset
|
8 |
#include "debug.h" |
6949
72d11a1e1e60
(svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents:
6676
diff
changeset
|
9 |
#include "landscape.h" |
5352
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5320
diff
changeset
|
10 |
#include "newgrf.h" |
8246
ff7b892d8a28
(svn r11287) -Codechange: add support for pushing paramaters into NewIndustries' error messages. Patch by Csaboka.
rubidium
parents:
8017
diff
changeset
|
11 |
#include "newgrf_text.h" |
2162
c1ded3bd3d0c
(svn r2672) Move saving/loading related declarations to saveload.h
tron
parents:
2159
diff
changeset
|
12 |
#include "saveload.h" |
8604
8afdd9877afd
(svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents:
8603
diff
changeset
|
13 |
#include "tile_map.h" |
0 | 14 |
#include "gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
15 |
#include "window_gui.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
16 |
#include "station_gui.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
17 |
#include "textbuf_gui.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
18 |
#include "viewport_func.h" |
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
19 |
#include "gfx_func.h" |
9281
d8cd9ac52a68
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
9244
diff
changeset
|
20 |
#include "station_func.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8610
diff
changeset
|
21 |
#include "command_func.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8720
diff
changeset
|
22 |
#include "player_func.h" |
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8720
diff
changeset
|
23 |
#include "player_base.h" |
0 | 24 |
#include "town.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5698
diff
changeset
|
25 |
#include "network/network.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2134
diff
changeset
|
26 |
#include "variables.h" |
10225
8becb17444a7
(svn r12757) -Codechange: move all cheat related stuff from all over the place to a single location.
rubidium
parents:
10155
diff
changeset
|
27 |
#include "cheat_func.h" |
3890
f8f13a91446a
(svn r4946) "Feature": Add a cheat that allows running electric engines on normal rail
celestar
parents:
3798
diff
changeset
|
28 |
#include "train.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
29 |
#include "tgp.h" |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
6144
diff
changeset
|
30 |
#include "cargotype.h" |
6516
ee6d057b9850
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
6417
diff
changeset
|
31 |
#include "player_face.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8604
diff
changeset
|
32 |
#include "strings_func.h" |
7425
350b9265b7a2
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
rubidium
parents:
7371
diff
changeset
|
33 |
#include "fileio.h" |
4223
0f9535dda7ed
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4217
diff
changeset
|
34 |
#include "fios.h" |
8615
6b91ca653bad
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
8612
diff
changeset
|
35 |
#include "tile_cmd.h" |
8619
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8617
diff
changeset
|
36 |
#include "zoom_func.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8619
diff
changeset
|
37 |
#include "functions.h" |
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8619
diff
changeset
|
38 |
#include "window_func.h" |
8636
2b158acb649c
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents:
8635
diff
changeset
|
39 |
#include "date_func.h" |
8653
a83f7a536919
(svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents:
8648
diff
changeset
|
40 |
#include "sound_func.h" |
8710
52015340050c
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8704
diff
changeset
|
41 |
#include "string_func.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8720
diff
changeset
|
42 |
#include "player_gui.h" |
8766
c86cfa3a7580
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8760
diff
changeset
|
43 |
#include "settings_type.h" |
9283
624272490f5a
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium
parents:
9281
diff
changeset
|
44 |
#include "newgrf_cargo.h" |
9305
0c214cd8b39e
(svn r12550) -Change: the signal GUI is now persistent - has the same data when it is reopened
smatz
parents:
9283
diff
changeset
|
45 |
#include "rail_gui.h" |
10445
2dd7d9d0a957
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
10434
diff
changeset
|
46 |
#include "tilehighlight_func.h" |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
47 |
#include "querystring_gui.h" |
8615
6b91ca653bad
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
8612
diff
changeset
|
48 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
49 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
50 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
51 |
|
4223
0f9535dda7ed
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4217
diff
changeset
|
52 |
/* Variables to display file lists */ |
8645
83500ad80b08
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
8640
diff
changeset
|
53 |
SaveLoadDialogMode _saveload_mode; |
0 | 54 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
55 |
|
1596
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
56 |
static bool _fios_path_changed; |
1594
1cbbb77f5bb2
(svn r2098) Make a variable static, move a function declaration to a header and remove unnecessary preprocessor magic
tron
parents:
1578
diff
changeset
|
57 |
static bool _savegame_sort_dirty; |
1cbbb77f5bb2
(svn r2098) Make a variable static, move a function declaration to a header and remove unnecessary preprocessor magic
tron
parents:
1578
diff
changeset
|
58 |
|
0 | 59 |
static const Widget _land_info_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
60 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
860
diff
changeset
|
61 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 279, 0, 13, STR_01A3_LAND_AREA_INFORMATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
11045
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
62 |
{ WWT_PANEL, RESIZE_BOTTOM, 14, 0, 279, 14, 99, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
63 |
{ WIDGETS_END}, |
0 | 64 |
}; |
65 |
||
66 |
static const WindowDesc _land_info_desc = { |
|
11045
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
67 |
WDP_AUTO, WDP_AUTO, 280, 100, 280, 100, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6001
diff
changeset
|
68 |
WC_LAND_INFO, WC_NONE, |
0 | 69 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
70 |
_land_info_widgets, |
|
71 |
}; |
|
72 |
||
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
73 |
class LandInfoWindow : public Window { |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
74 |
enum { |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
75 |
LAND_INFO_CENTERED_LINES = 9, ///< Up to 9 centered lines |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
76 |
LAND_INFO_MULTICENTER_LINE = LAND_INFO_CENTERED_LINES, ///< One multicenter line |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
77 |
LAND_INFO_LINE_END, |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
78 |
|
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
79 |
LAND_INFO_LINE_BUFF_SIZE = 512, |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
80 |
}; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
81 |
|
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
82 |
public: |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
83 |
char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE]; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
84 |
|
10490
e24144bd48c9
(svn r13033) -Fix [FS#2003](r13029): land info tool wasn't working
smatz
parents:
10486
diff
changeset
|
85 |
virtual void OnPaint() |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
86 |
{ |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10594
diff
changeset
|
87 |
this->DrawWidgets(); |
5834
7bf92d5a5a0f
(svn r8030) -Fix: segmentation fault when removing a town in the scenario editor while having the query tool window open for one of the town's tiles.
rubidium
parents:
5726
diff
changeset
|
88 |
|
11045
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
89 |
uint y = 21; |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
90 |
for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) { |
11045
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
91 |
if (StrEmpty(this->landinfo_data[i])) break; |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
92 |
|
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
93 |
DoDrawStringCentered(140, y, this->landinfo_data[i], i == 0 ? TC_LIGHT_BLUE : TC_FROMSTRING); |
11045
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
94 |
y += i == 0 ? 16 : 12; |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
95 |
} |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
96 |
|
11045
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
97 |
y += 6; |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
98 |
|
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
99 |
if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) { |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
100 |
SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
101 |
DrawStringMultiCenter(140, y, STR_JUST_RAW_STRING, this->width - 4); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
102 |
} |
5834
7bf92d5a5a0f
(svn r8030) -Fix: segmentation fault when removing a town in the scenario editor while having the query tool window open for one of the town's tiles.
rubidium
parents:
5726
diff
changeset
|
103 |
} |
7bf92d5a5a0f
(svn r8030) -Fix: segmentation fault when removing a town in the scenario editor while having the query tool window open for one of the town's tiles.
rubidium
parents:
5726
diff
changeset
|
104 |
|
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
105 |
LandInfoWindow(TileIndex tile) : Window(&_land_info_desc) { |
11161
7d0fac8f14cd
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
11157
diff
changeset
|
106 |
Player *p = GetPlayer(IsValidPlayerID(_local_player) ? _local_player : PLAYER_FIRST); |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10768
diff
changeset
|
107 |
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority); |
5834
7bf92d5a5a0f
(svn r8030) -Fix: segmentation fault when removing a town in the scenario editor while having the query tool window open for one of the town's tiles.
rubidium
parents:
5726
diff
changeset
|
108 |
|
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
109 |
Money old_money = p->player_money; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
110 |
p->player_money = INT64_MAX; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
111 |
CommandCost costclear = DoCommand(tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
112 |
p->player_money = old_money; |
5834
7bf92d5a5a0f
(svn r8030) -Fix: segmentation fault when removing a town in the scenario editor while having the query tool window open for one of the town's tiles.
rubidium
parents:
5726
diff
changeset
|
113 |
|
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
114 |
/* Because build_date is not set yet in every TileDesc, we make sure it is empty */ |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
115 |
TileDesc td; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
116 |
AcceptedCargo ac; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
117 |
|
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
118 |
td.build_date = 0; |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
119 |
|
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
120 |
/* Most tiles have only one owner, but |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
121 |
* - drivethrough roadstops can be build on town owned roads (up to 2 owners) and |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
122 |
* - roads can have up to four owners (railroad, road, tram, 3rd-roadtype "highway"). |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
123 |
*/ |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
124 |
td.owner_type[0] = STR_01A7_OWNER; // At least one owner is displayed, though it might be "N/A". |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
125 |
td.owner_type[1] = STR_NULL; // STR_NULL results in skipping the owner |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
126 |
td.owner_type[2] = STR_NULL; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
127 |
td.owner_type[3] = STR_NULL; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
128 |
td.owner[0] = OWNER_NONE; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
129 |
td.owner[1] = OWNER_NONE; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
130 |
td.owner[2] = OWNER_NONE; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
131 |
td.owner[3] = OWNER_NONE; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
132 |
|
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
133 |
GetAcceptedCargo(tile, ac); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
134 |
GetTileDesc(tile, &td); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
135 |
|
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
136 |
uint line_nr = 0; |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
137 |
|
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
138 |
/* Tiletype */ |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
139 |
SetDParam(0, td.dparam[0]); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
140 |
GetString(this->landinfo_data[line_nr], td.str, lastof(this->landinfo_data[line_nr])); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
141 |
line_nr++; |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
142 |
|
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
143 |
/* Up to four owners */ |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
144 |
for (uint i = 0; i < 4; i++) { |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
145 |
if (td.owner_type[i] == STR_NULL) continue; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
146 |
|
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
147 |
SetDParam(0, STR_01A6_N_A); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
148 |
if (td.owner[i] != OWNER_NONE && td.owner[i] != OWNER_WATER) GetNameOfOwner(td.owner[i], tile); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
149 |
GetString(this->landinfo_data[line_nr], td.owner_type[i], lastof(this->landinfo_data[line_nr])); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
150 |
line_nr++; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
151 |
} |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
152 |
|
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
153 |
/* Cost to clear */ |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
154 |
StringID str = STR_01A4_COST_TO_CLEAR_N_A; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
155 |
if (CmdSucceeded(costclear)) { |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
156 |
SetDParam(0, costclear.GetCost()); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
157 |
str = STR_01A5_COST_TO_CLEAR; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
158 |
} |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
159 |
GetString(this->landinfo_data[line_nr], str, lastof(this->landinfo_data[line_nr])); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
160 |
line_nr++; |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
161 |
|
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
162 |
/* Location */ |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
163 |
char tmp[16]; |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
164 |
snprintf(tmp, lengthof(tmp), "0x%.4X", tile); |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
165 |
SetDParam(0, TileX(tile)); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
166 |
SetDParam(1, TileY(tile)); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
167 |
SetDParam(2, TileHeight(tile)); |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
168 |
SetDParamStr(3, tmp); |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
169 |
GetString(this->landinfo_data[line_nr], STR_LANDINFO_COORDS, lastof(this->landinfo_data[line_nr])); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
170 |
line_nr++; |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
171 |
|
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
172 |
/* Local authority */ |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
173 |
SetDParam(0, STR_01A9_NONE); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
174 |
if (t != NULL && t->IsValid()) { |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
175 |
SetDParam(0, STR_TOWN); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
176 |
SetDParam(1, t->index); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
177 |
} |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
178 |
GetString(this->landinfo_data[line_nr], STR_01A8_LOCAL_AUTHORITY, lastof(this->landinfo_data[line_nr])); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
179 |
line_nr++; |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
180 |
|
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
181 |
/* Build date */ |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
182 |
if (td.build_date != 0) { |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
183 |
SetDParam(0, td.build_date); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
184 |
GetString(this->landinfo_data[line_nr], STR_BUILD_DATE, lastof(this->landinfo_data[line_nr])); |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
185 |
line_nr++; |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
186 |
} |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
187 |
|
11045
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
188 |
/* Mark last line empty */ |
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
189 |
this->landinfo_data[line_nr][0] = '\0'; |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
190 |
|
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
191 |
/* Cargo acceptance is displayed in a extra multiline */ |
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
192 |
char *strp = GetString(this->landinfo_data[LAND_INFO_MULTICENTER_LINE], STR_01CE_CARGO_ACCEPTED, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])); |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
193 |
bool found = false; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
194 |
|
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
195 |
for (CargoID i = 0; i < NUM_CARGO; ++i) { |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
196 |
if (ac[i] > 0) { |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
197 |
/* Add a comma between each item. */ |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
198 |
if (found) { |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
199 |
*strp++ = ','; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
200 |
*strp++ = ' '; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
201 |
} |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
202 |
found = true; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
203 |
|
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
204 |
/* If the accepted value is less than 8, show it in 1/8:ths */ |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
205 |
if (ac[i] < 8) { |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
206 |
SetDParam(0, ac[i]); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
207 |
SetDParam(1, GetCargo(i)->name); |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
208 |
strp = GetString(strp, STR_01D1_8, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])); |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
209 |
} else { |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
210 |
strp = GetString(strp, GetCargo(i)->name, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])); |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
211 |
} |
5834
7bf92d5a5a0f
(svn r8030) -Fix: segmentation fault when removing a town in the scenario editor while having the query tool window open for one of the town's tiles.
rubidium
parents:
5726
diff
changeset
|
212 |
} |
7bf92d5a5a0f
(svn r8030) -Fix: segmentation fault when removing a town in the scenario editor while having the query tool window open for one of the town's tiles.
rubidium
parents:
5726
diff
changeset
|
213 |
} |
10662
f455941692a3
(svn r13206) -Feature(ette): Display all owners of a tile in the tile-info-window.
frosch
parents:
10647
diff
changeset
|
214 |
if (!found) this->landinfo_data[LAND_INFO_MULTICENTER_LINE][0] = '\0'; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
215 |
|
11045
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
216 |
if (found) line_nr += 2; |
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
217 |
|
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
218 |
if (line_nr > 6) ResizeWindow(this, 0, 12 * (line_nr - 6)); |
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
219 |
|
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
220 |
this->FindWindowPlacementAndResize(&_land_info_desc); |
60c076d531f9
(svn r13601) -Codechange: resize the Tile Info window when it is needed, make it better readable
smatz
parents:
10808
diff
changeset
|
221 |
|
4000
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3890
diff
changeset
|
222 |
#if defined(_DEBUG) |
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3890
diff
changeset
|
223 |
# define LANDINFOD_LEVEL 0 |
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3890
diff
changeset
|
224 |
#else |
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3890
diff
changeset
|
225 |
# define LANDINFOD_LEVEL 1 |
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3890
diff
changeset
|
226 |
#endif |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
227 |
DEBUG(misc, LANDINFOD_LEVEL, "TILE: %#x (%i,%i)", tile, TileX(tile), TileY(tile)); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
228 |
DEBUG(misc, LANDINFOD_LEVEL, "type_height = %#x", _m[tile].type_height); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
229 |
DEBUG(misc, LANDINFOD_LEVEL, "m1 = %#x", _m[tile].m1); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
230 |
DEBUG(misc, LANDINFOD_LEVEL, "m2 = %#x", _m[tile].m2); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
231 |
DEBUG(misc, LANDINFOD_LEVEL, "m3 = %#x", _m[tile].m3); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
232 |
DEBUG(misc, LANDINFOD_LEVEL, "m4 = %#x", _m[tile].m4); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
233 |
DEBUG(misc, LANDINFOD_LEVEL, "m5 = %#x", _m[tile].m5); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
234 |
DEBUG(misc, LANDINFOD_LEVEL, "m6 = %#x", _m[tile].m6); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
235 |
DEBUG(misc, LANDINFOD_LEVEL, "m7 = %#x", _me[tile].m7); |
4000
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3890
diff
changeset
|
236 |
#undef LANDINFOD_LEVEL |
10475
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
237 |
} |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
238 |
}; |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
239 |
|
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
240 |
static void Place_LandInfo(TileIndex tile) |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
241 |
{ |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
242 |
DeleteWindowById(WC_LAND_INFO, 0); |
6b7ca9f978f0
(svn r13018) -Codechange: make a class of the LandInfo Window.
rubidium
parents:
10472
diff
changeset
|
243 |
new LandInfoWindow(tile); |
0 | 244 |
} |
245 |
||
6573 | 246 |
void PlaceLandBlockInfo() |
0 | 247 |
{ |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
248 |
if (_cursor.sprite == SPR_CURSOR_QUERY) { |
0 | 249 |
ResetObjectToPlace(); |
250 |
} else { |
|
251 |
_place_proc = Place_LandInfo; |
|
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8355
diff
changeset
|
252 |
SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, VHM_RECT, WC_MAIN_TOOLBAR, 0); |
0 | 253 |
} |
254 |
} |
|
255 |
||
256 |
static const Widget _about_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
257 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
258 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 419, 0, 13, STR_015B_OPENTTD, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
259 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 419, 14, 271, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
260 |
{ WWT_FRAME, RESIZE_NONE, 14, 5, 414, 40, 245, STR_NULL, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
261 |
{ WIDGETS_END}, |
0 | 262 |
}; |
263 |
||
264 |
static const WindowDesc _about_desc = { |
|
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7817
diff
changeset
|
265 |
WDP_CENTER, WDP_CENTER, 420, 272, 420, 272, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6001
diff
changeset
|
266 |
WC_GAME_OPTIONS, WC_NONE, |
0 | 267 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
268 |
_about_widgets, |
|
269 |
}; |
|
270 |
||
10549
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
271 |
struct AboutWindow : public Window { |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
272 |
int scroll_height; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
273 |
uint16 counter; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
274 |
|
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
275 |
AboutWindow() : Window(&_about_desc) |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
276 |
{ |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
277 |
this->counter = 5; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
278 |
this->scroll_height = this->height - 40; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
279 |
this->FindWindowPlacementAndResize(&_about_desc); |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
280 |
} |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
281 |
|
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
282 |
virtual void OnPaint() |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
283 |
{ |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
284 |
static const char *credits[] = { |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
285 |
/************************************************************************* |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
286 |
* maximum length of string which fits in window -^*/ |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
287 |
"Original design by Chris Sawyer", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
288 |
"Original graphics by Simon Foster", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
289 |
"", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
290 |
"The OpenTTD team (in alphabetical order):", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
291 |
" Jean-Francois Claeys (Belugas) - GUI, newindustries and more", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
292 |
" Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
293 |
" Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
294 |
" Loïc Guilloux (glx) - General coding", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
295 |
" Christoph Elsenhans (frosch) - General coding", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
296 |
" Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
297 |
" Jonathan Coome (Maedhros) - High priest of the newGRF Temple", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
298 |
" Attila Bán (MiHaMiX) - WebTranslator, Nightlies, Wiki and bugtracker host", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
299 |
" Owen Rudge (orudge) - Forum host, OS/2 port", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
300 |
" Peter Nelson (peter1138) - Spiritual descendant from newGRF gods", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
301 |
" Remko Bijker (Rubidium) - Lead coder and way more", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
302 |
" Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
303 |
" Zdenek Sojka (SmatZ) - Bug finder and fixer", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
304 |
"", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
305 |
"Inactive Developers:", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
306 |
" Victor Fischer (Celestar) - Programming everywhere you need him to", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
307 |
" Tamás Faragó (Darkvater) - Ex-Lead coder", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
308 |
" Christoph Mallon (Tron) - Programmer, code correctness police", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
309 |
"", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
310 |
"Retired Developers:", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
311 |
" Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
312 |
" Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
313 |
" Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
314 |
" Patric Stout (TrueLight) - Programmer, webhoster (0.3 - pre0.6)", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
315 |
"", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
316 |
"Special thanks go out to:", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
317 |
" Josef Drexler - For his great work on TTDPatch", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
318 |
" Marcin Grzegorczyk - For his documentation of TTD internals", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
319 |
" Petr Baudis (pasky) - Many patches, newGRF support", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
320 |
" Stefan Meißner (sign_de) - For his work on the console", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
321 |
" Simon Sasburg (HackyKid) - Many bugfixes he has blessed us with", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
322 |
" Cian Duffy (MYOB) - BeOS port / manual writing", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
323 |
" Christian Rosentreter (tokai) - MorphOS / AmigaOS port", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
324 |
" Richard Kempton (richK) - additional airports, initial TGP implementation", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
325 |
"", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
326 |
" Michael Blunck - Pre-Signals and Semaphores © 2003", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
327 |
" George - Canal/Lock graphics © 2003-2004", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
328 |
" David Dallaston - Tram tracks", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
329 |
" Marcin Grzegorczyk - Foundations for Tracks on Slopes", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
330 |
" All Translators - Who made OpenTTD a truly international game", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
331 |
" Bug Reporters - Without whom OpenTTD would still be full of bugs!", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
332 |
"", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
333 |
"", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
334 |
"And last but not least:", |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
335 |
" Chris Sawyer - For an amazing game!" |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
336 |
}; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
337 |
|
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10594
diff
changeset
|
338 |
this->DrawWidgets(); |
10549
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
339 |
|
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
340 |
/* Show original copyright and revision version */ |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
341 |
DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, TC_FROMSTRING); |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
342 |
DrawStringCentered(210, 17 + 10, STR_00B7_VERSION, TC_FROMSTRING); |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
343 |
|
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
344 |
int y = this->scroll_height; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
345 |
|
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
346 |
/* Show all scrolling credits */ |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
347 |
for (uint i = 0; i < lengthof(credits); i++) { |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
348 |
if (y >= 50 && y < (this->height - 40)) { |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
349 |
DoDrawString(credits[i], 10, y, TC_BLACK); |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
350 |
} |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
351 |
y += 10; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
352 |
} |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
353 |
|
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
354 |
/* If the last text has scrolled start a new from the start */ |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
355 |
if (y < 50) this->scroll_height = this->height - 40; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
356 |
|
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
357 |
DoDrawStringCentered(210, this->height - 25, "Website: http://www.openttd.org", TC_BLACK); |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
358 |
DrawStringCentered(210, this->height - 15, STR_00BA_COPYRIGHT_OPENTTD, TC_FROMSTRING); |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
359 |
} |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
360 |
|
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
361 |
virtual void OnTick() |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
362 |
{ |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
363 |
if (--this->counter == 0) { |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
364 |
this->counter = 5; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
365 |
this->scroll_height--; |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
366 |
this->SetDirty(); |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
367 |
} |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
368 |
} |
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
369 |
}; |
0 | 370 |
|
6573 | 371 |
void ShowAboutWindow() |
0 | 372 |
{ |
373 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
10549
96b788f0380e
(svn r13093) -Codechange: make a class of AboutWindow.
glx
parents:
10548
diff
changeset
|
374 |
new AboutWindow(); |
0 | 375 |
} |
376 |
||
377 |
static const Widget _errmsg_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
378 |
{ WWT_CLOSEBOX, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
379 |
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 239, 0, 13, STR_00B2_MESSAGE, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
380 |
{ WWT_PANEL, RESIZE_NONE, 4, 0, 239, 14, 45, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
381 |
{ WIDGETS_END}, |
0 | 382 |
}; |
383 |
||
384 |
static const Widget _errmsg_face_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
385 |
{ WWT_CLOSEBOX, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
386 |
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 333, 0, 13, STR_00B3_MESSAGE_FROM, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
387 |
{ WWT_PANEL, RESIZE_NONE, 4, 0, 333, 14, 136, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
388 |
{ WIDGETS_END}, |
0 | 389 |
}; |
390 |
||
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
391 |
struct ErrmsgWindow : public Window { |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
392 |
private: |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
393 |
uint duration; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
394 |
uint64 decode_params[20]; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
395 |
StringID message_1; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
396 |
StringID message_2; |
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
397 |
bool show_player_face; |
0 | 398 |
|
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
399 |
public: |
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
400 |
ErrmsgWindow(Point pt, int width, int height, StringID msg1, StringID msg2, const Widget *widget, bool show_player_face) : |
10625
3c1f6a26db71
(svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium
parents:
10607
diff
changeset
|
401 |
Window(pt.x, pt.y, width, height, WC_ERRMSG, widget), |
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
402 |
show_player_face(show_player_face) |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
403 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10768
diff
changeset
|
404 |
this->duration = _settings_client.gui.errmsg_duration; |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
405 |
CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params)); |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
406 |
this->message_1 = msg1; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
407 |
this->message_2 = msg2; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
408 |
this->desc_flags = WDF_STD_BTN | WDF_DEF_WIDGET; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
409 |
this->FindWindowPlacementAndResize(width, height); |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
410 |
} |
2639 | 411 |
|
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
412 |
virtual void OnPaint() |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
413 |
{ |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
414 |
static int y[][3] = { |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
415 |
{15, 25, 30}, // _errmsg_widgets |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
416 |
{45, 65, 90}, // _errmsg_face_widgets |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
417 |
}; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
418 |
|
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
419 |
CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10594
diff
changeset
|
420 |
this->DrawWidgets(); |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
421 |
CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
422 |
|
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
423 |
/* If the error message comes from a NewGRF, we must use the text ref. stack reserved for error messages. |
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
424 |
* If the message doesn't come from a NewGRF, it won't use the TTDP-style text ref. stack, so we won't hurt anything |
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
425 |
*/ |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
426 |
SwitchToErrorRefStack(); |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
427 |
RewindTextRefStack(); |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
428 |
|
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
429 |
if (this->show_player_face) { |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
430 |
const Player *p = GetPlayer((PlayerID)GetDParamX(this->decode_params, 2)); |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
431 |
DrawPlayerFace(p->face, p->player_color, 2, 16); |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
432 |
} |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
433 |
|
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
434 |
byte j = (this->message_1 == INVALID_STRING_ID) ? 1 : 0; |
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
435 |
DrawStringMultiCenter(this->width - 120, y[this->show_player_face][j], this->message_2, this->width - 2); |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
436 |
if (j == 0) { |
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
437 |
DrawStringMultiCenter(this->width - 120, y[this->show_player_face][2], this->message_1, this->width - 2); |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
438 |
} |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
439 |
|
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
440 |
/* Switch back to the normal text ref. stack for NewGRF texts */ |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
441 |
SwitchToNormalRefStack(); |
0 | 442 |
} |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
443 |
|
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
444 |
virtual void OnMouseLoop() |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
445 |
{ |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
446 |
if (_right_button_down) delete this; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
447 |
} |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
448 |
|
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
449 |
virtual void OnHundredthTick() |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
450 |
{ |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
451 |
if (--this->duration == 0) delete this; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
452 |
} |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
453 |
|
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
454 |
~ErrmsgWindow() |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
455 |
{ |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
456 |
SetRedErrorSquare(0); |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
457 |
extern StringID _switch_mode_errorstr; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
458 |
_switch_mode_errorstr = INVALID_STRING_ID; |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
459 |
} |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
460 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
461 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
462 |
{ |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
463 |
if (keycode != WKC_SPACE) return ES_NOT_HANDLED; |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
464 |
delete this; |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
465 |
return ES_HANDLED; |
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
466 |
} |
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
467 |
}; |
0 | 468 |
|
469 |
void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y) |
|
470 |
{ |
|
471 |
DeleteWindowById(WC_ERRMSG, 0); |
|
472 |
||
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10768
diff
changeset
|
473 |
if (!_settings_client.gui.errmsg_duration) return; |
0 | 474 |
|
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
475 |
if (msg_2 == STR_NULL) msg_2 = STR_EMPTY; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
476 |
|
9315 | 477 |
Point pt; |
478 |
const ViewPort *vp; |
|
479 |
||
10587
70ace93a49d1
(svn r13131) -Codechange: make a class of the ErrmsgWindow.
glx
parents:
10550
diff
changeset
|
480 |
if (msg_1 != STR_013B_OWNED_BY || GetDParam(2) >= 8) { |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
481 |
if ((x | y) != 0) { |
0 | 482 |
pt = RemapCoords2(x, y); |
5120
e12dfc67761f
(svn r7200) -Codechange: remove unneeded redraw (console.c), coding style, use FindWindowById
Darkvater
parents:
5116
diff
changeset
|
483 |
vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; |
0 | 484 |
|
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6523
diff
changeset
|
485 |
/* move x pos to opposite corner */ |
7122
0607a15aedc0
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
6988
diff
changeset
|
486 |
pt.x = UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left; |
0 | 487 |
pt.x = (pt.x < (_screen.width >> 1)) ? _screen.width - 260 : 20; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
488 |
|
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6523
diff
changeset
|
489 |
/* move y pos to opposite corner */ |
7122
0607a15aedc0
(svn r9846) -Codechange: introduced ZOOM_LVL_MIN and ZOOM_LVL_MAX for the obvious reasons
truelight
parents:
6988
diff
changeset
|
490 |
pt.y = UnScaleByZoom(pt.y - vp->virtual_top, vp->zoom) + vp->top; |
0 | 491 |
pt.y = (pt.y < (_screen.height >> 1)) ? _screen.height - 80 : 100; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
492 |
|
0 | 493 |
} else { |
494 |
pt.x = (_screen.width - 240) >> 1; |
|
495 |
pt.y = (_screen.height - 46) >> 1; |
|
496 |
} |
|
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
497 |
new ErrmsgWindow(pt, 240, 46, msg_1, msg_2, _errmsg_widgets, false); |
0 | 498 |
} else { |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
499 |
if ((x | y) != 0) { |
0 | 500 |
pt = RemapCoords2(x, y); |
5120
e12dfc67761f
(svn r7200) -Codechange: remove unneeded redraw (console.c), coding style, use FindWindowById
Darkvater
parents:
5116
diff
changeset
|
501 |
vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; |
8418
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8385
diff
changeset
|
502 |
pt.x = Clamp(UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left - (334/2), 0, _screen.width - 334); |
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8385
diff
changeset
|
503 |
pt.y = Clamp(UnScaleByZoom(pt.y - vp->virtual_top, vp->zoom) + vp->top - (137/2), 22, _screen.height - 137); |
0 | 504 |
} else { |
505 |
pt.x = (_screen.width - 334) >> 1; |
|
506 |
pt.y = (_screen.height - 137) >> 1; |
|
507 |
} |
|
10594
c9f7df384405
(svn r13138) -Codechange: remove the need for IsWindowOfPrototype.
rubidium
parents:
10587
diff
changeset
|
508 |
new ErrmsgWindow(pt, 334, 137, msg_1, msg_2, _errmsg_face_widgets, true); |
0 | 509 |
} |
510 |
} |
|
511 |
||
7486
d130c10f4dab
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
7449
diff
changeset
|
512 |
void ShowEstimatedCostOrIncome(Money cost, int x, int y) |
0 | 513 |
{ |
2498
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2475
diff
changeset
|
514 |
StringID msg = STR_0805_ESTIMATED_COST; |
0 | 515 |
|
516 |
if (cost < 0) { |
|
517 |
cost = -cost; |
|
518 |
msg = STR_0807_ESTIMATED_INCOME; |
|
519 |
} |
|
7498
ce6588257e8d
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
7494
diff
changeset
|
520 |
SetDParam(0, cost); |
2498
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2475
diff
changeset
|
521 |
ShowErrorMessage(INVALID_STRING_ID, msg, x, y); |
0 | 522 |
} |
523 |
||
7486
d130c10f4dab
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
7449
diff
changeset
|
524 |
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost) |
0 | 525 |
{ |
526 |
Point pt = RemapCoords(x,y,z); |
|
9315 | 527 |
StringID msg = STR_0801_COST; |
0 | 528 |
|
529 |
if (cost < 0) { |
|
530 |
cost = -cost; |
|
531 |
msg = STR_0803_INCOME; |
|
532 |
} |
|
7498
ce6588257e8d
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
7494
diff
changeset
|
533 |
SetDParam(0, cost); |
7494
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
534 |
AddTextEffect(msg, pt.x, pt.y, 0x250, TE_RISING); |
0 | 535 |
} |
536 |
||
7486
d130c10f4dab
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
7449
diff
changeset
|
537 |
void ShowFeederIncomeAnimation(int x, int y, int z, Money cost) |
1935
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1914
diff
changeset
|
538 |
{ |
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1914
diff
changeset
|
539 |
Point pt = RemapCoords(x,y,z); |
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1914
diff
changeset
|
540 |
|
7498
ce6588257e8d
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
7494
diff
changeset
|
541 |
SetDParam(0, cost); |
7494
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
542 |
AddTextEffect(STR_FEEDER, pt.x, pt.y, 0x250, TE_RISING); |
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
543 |
} |
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
544 |
|
7510
acb7cfe27b60
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
truelight
parents:
7503
diff
changeset
|
545 |
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID string) |
7494
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
546 |
{ |
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
547 |
Point pt = RemapCoords(x, y, z); |
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
548 |
|
7510
acb7cfe27b60
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
truelight
parents:
7503
diff
changeset
|
549 |
assert(string != STR_NULL); |
acb7cfe27b60
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
truelight
parents:
7503
diff
changeset
|
550 |
|
7494
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
551 |
SetDParam(0, percent); |
7510
acb7cfe27b60
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
truelight
parents:
7503
diff
changeset
|
552 |
return AddTextEffect(string, pt.x, pt.y, 0xFFFF, TE_STATIC); |
7494
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
553 |
} |
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
554 |
|
7510
acb7cfe27b60
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
truelight
parents:
7503
diff
changeset
|
555 |
void UpdateFillingPercent(TextEffectID te_id, uint8 percent, StringID string) |
7494
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
556 |
{ |
7510
acb7cfe27b60
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
truelight
parents:
7503
diff
changeset
|
557 |
assert(string != STR_NULL); |
acb7cfe27b60
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
truelight
parents:
7503
diff
changeset
|
558 |
|
7494
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
559 |
SetDParam(0, percent); |
7510
acb7cfe27b60
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
truelight
parents:
7503
diff
changeset
|
560 |
UpdateTextEffect(te_id, string); |
7494
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
561 |
} |
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
562 |
|
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
563 |
void HideFillingPercent(TextEffectID te_id) |
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
564 |
{ |
99eac2a2cd8b
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight
parents:
7487
diff
changeset
|
565 |
if (te_id != INVALID_TE_ID) RemoveTextEffect(te_id); |
1935
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1914
diff
changeset
|
566 |
} |
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1914
diff
changeset
|
567 |
|
2275
cbaeb07740b1
(svn r2799) Make the only two non-const widget lists const
tron
parents:
2261
diff
changeset
|
568 |
static const Widget _tooltips_widgets[] = { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
860
diff
changeset
|
569 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 199, 0, 31, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
570 |
{ WIDGETS_END}, |
0 | 571 |
}; |
572 |
||
10506
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
573 |
struct TooltipsWindow : public Window |
0 | 574 |
{ |
10506
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
575 |
StringID string_id; |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
576 |
byte paramcount; |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
577 |
uint64 params[5]; |
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
578 |
|
10506
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
579 |
TooltipsWindow(int x, int y, int width, int height, const Widget *widget, |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
580 |
StringID str, uint paramcount, const uint64 params[]) : |
10625
3c1f6a26db71
(svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium
parents:
10607
diff
changeset
|
581 |
Window(x, y, width, height, WC_TOOLTIPS, widget) |
10506
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
582 |
{ |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
583 |
this->string_id = str; |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
584 |
assert(sizeof(this->params[0]) == sizeof(params[0])); |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
585 |
memcpy(this->params, params, sizeof(this->params[0]) * paramcount); |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
586 |
this->paramcount = paramcount; |
0 | 587 |
|
10506
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
588 |
this->flags4 &= ~WF_WHITE_BORDER_MASK; // remove white-border from tooltip |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
589 |
this->widget[0].right = width; |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
590 |
this->widget[0].bottom = height; |
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
591 |
|
10506
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
592 |
FindWindowPlacementAndResize(width, height); |
0 | 593 |
} |
10506
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
594 |
|
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
595 |
virtual void OnPaint() |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
596 |
{ |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
597 |
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0); |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
598 |
GfxFillRect(1, 1, this->width - 2, this->height - 2, 0x44); |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
599 |
|
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
600 |
for (uint arg = 0; arg < this->paramcount; arg++) { |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
601 |
SetDParam(arg, this->params[arg]); |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
602 |
} |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
603 |
DrawStringMultiCenter((this->width >> 1), (this->height >> 1) - 5, this->string_id, this->width - 2); |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
604 |
} |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
605 |
|
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
606 |
virtual void OnMouseLoop() |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
607 |
{ |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
608 |
/* We can show tooltips while dragging tools. These are shown as long as |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
609 |
* we are dragging the tool. Normal tooltips work with rmb */ |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
610 |
if (this->paramcount == 0 ) { |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
611 |
if (!_right_button_down) delete this; |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
612 |
} else { |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
613 |
if (!_left_button_down) delete this; |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
614 |
} |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
615 |
} |
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
616 |
}; |
0 | 617 |
|
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
618 |
/** Shows a tooltip |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
619 |
* @param str String to be displayed |
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
620 |
* @param paramcount number of params to deal with |
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
621 |
* @param params (optional) up to 5 pieces of additional information that may be |
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
622 |
* added to a tooltip; currently only supports parameters of {NUM} (integer) */ |
7502
71f5d2c6a605
(svn r10262) -Fix (r10258): some places that needed to be changed to uint64 were hidden/forgotten, which caused memory corruptions and that in caused all kinds of assertions to trigger.
rubidium
parents:
7498
diff
changeset
|
623 |
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]) |
0 | 624 |
{ |
4884
895f06b87934
(svn r6821) -Codechange: For the measurement tool do not show the tooltip when the selection
Darkvater
parents:
4850
diff
changeset
|
625 |
DeleteWindowById(WC_TOOLTIPS, 0); |
0 | 626 |
|
4884
895f06b87934
(svn r6821) -Codechange: For the measurement tool do not show the tooltip when the selection
Darkvater
parents:
4850
diff
changeset
|
627 |
/* We only show measurement tooltips with patch setting on */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10768
diff
changeset
|
628 |
if (str == STR_NULL || (paramcount != 0 && !_settings_client.gui.measure_tooltip)) return; |
0 | 629 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
630 |
for (uint i = 0; i != paramcount; i++) SetDParam(i, params[i]); |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
631 |
char buffer[512]; |
4912
d04b3f2bca70
(svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents:
4909
diff
changeset
|
632 |
GetString(buffer, str, lastof(buffer)); |
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
633 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
634 |
Dimension br = GetStringBoundingBox(buffer); |
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
635 |
br.width += 6; br.height += 4; // increase slightly to have some space around the box |
0 | 636 |
|
4558
657e73957b4b
(svn r6405) -Codechange: When showing tooltips, properly position the tooltip, considering
Darkvater
parents:
4416
diff
changeset
|
637 |
/* Cut tooltip length to 200 pixels max, wrap to new line if longer */ |
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
638 |
if (br.width > 200) { |
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
639 |
br.height += ((br.width - 4) / 176) * 10; |
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
640 |
br.width = 200; |
0 | 641 |
} |
642 |
||
4558
657e73957b4b
(svn r6405) -Codechange: When showing tooltips, properly position the tooltip, considering
Darkvater
parents:
4416
diff
changeset
|
643 |
/* Correctly position the tooltip position, watch out for window and cursor size |
657e73957b4b
(svn r6405) -Codechange: When showing tooltips, properly position the tooltip, considering
Darkvater
parents:
4416
diff
changeset
|
644 |
* Clamp value to below main toolbar and above statusbar. If tooltip would |
657e73957b4b
(svn r6405) -Codechange: When showing tooltips, properly position the tooltip, considering
Darkvater
parents:
4416
diff
changeset
|
645 |
* go below window, flip it so it is shown above the cursor */ |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
646 |
int y = Clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, 22, _screen.height - 12); |
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4719
diff
changeset
|
647 |
if (y + br.height > _screen.height - 12) y = _cursor.pos.y + _cursor.offs.y - br.height - 5; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
648 |
int x = Clamp(_cursor.pos.x - (br.width >> 1), 0, _screen.width - br.width); |
0 | 649 |
|
10506
c73963963a8c
(svn r13049) -Codechange: make a class of the TooltipsWindow.
rubidium
parents:
10499
diff
changeset
|
650 |
new TooltipsWindow(x, y, br.width, br.height, _tooltips_widgets, str, paramcount, params); |
0 | 651 |
} |
652 |
||
653 |
||
9342
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
654 |
static int DrawStationCoverageText(const AcceptedCargo cargo, |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
655 |
int str_x, int str_y, StationCoverageType sct, bool supplies) |
0 | 656 |
{ |
5038
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
657 |
bool first = true; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
658 |
|
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
659 |
char string[512]; |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
660 |
char *b = InlineString(string, supplies ? STR_SUPPLIES : STR_000D_ACCEPTS); |
0 | 661 |
|
7737
7ab95e599292
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
7634
diff
changeset
|
662 |
for (CargoID i = 0; i < NUM_CARGO; i++) { |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
663 |
if (b >= lastof(string) - (1 + 2 * 4)) break; // ',' or ' ' and two calls to Utf8Encode() |
7737
7ab95e599292
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
7634
diff
changeset
|
664 |
switch (sct) { |
7ab95e599292
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
7634
diff
changeset
|
665 |
case SCT_PASSENGERS_ONLY: if (!IsCargoInClass(i, CC_PASSENGERS)) continue; break; |
7ab95e599292
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
7634
diff
changeset
|
666 |
case SCT_NON_PASSENGERS_ONLY: if (IsCargoInClass(i, CC_PASSENGERS)) continue; break; |
7ab95e599292
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
7634
diff
changeset
|
667 |
case SCT_ALL: break; |
7ab95e599292
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
7634
diff
changeset
|
668 |
default: NOT_REACHED(); |
7ab95e599292
(svn r10522) -Fix: the "build truck station" GUI showed that it would accept tourists when it does not, whereas the "build bus station" GUI did not show them when it did accept them.
rubidium
parents:
7634
diff
changeset
|
669 |
} |
10155 | 670 |
if (cargo[i] >= (supplies ? 1U : 8U)) { |
5038
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
671 |
if (first) { |
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
672 |
first = false; |
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
673 |
} else { |
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
674 |
/* Add a comma if this is not the first item */ |
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
675 |
*b++ = ','; |
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
676 |
*b++ = ' '; |
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
677 |
} |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
6144
diff
changeset
|
678 |
b = InlineString(b, GetCargo(i)->name); |
0 | 679 |
} |
680 |
} |
|
681 |
||
5038
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
682 |
/* If first is still true then no cargo is accepted */ |
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
683 |
if (first) b = InlineString(b, STR_00D0_NOTHING); |
0 | 684 |
|
5038
cd0a32afb616
(svn r7080) -Codechange: Remove negative array indexes, and only add ", " when needed, when building station acceptance lists.
peter1138
parents:
5005
diff
changeset
|
685 |
*b = '\0'; |
8537
0b4ab7d8b018
(svn r11601) -Codechange: more strict break conditions for _userstring, assert when it overflows anyway (eg. code change without proper check change)
smatz
parents:
8532
diff
changeset
|
686 |
|
0b4ab7d8b018
(svn r11601) -Codechange: more strict break conditions for _userstring, assert when it overflows anyway (eg. code change without proper check change)
smatz
parents:
8532
diff
changeset
|
687 |
/* Make sure we detect any buffer overflow */ |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
688 |
assert(b < endof(string)); |
8537
0b4ab7d8b018
(svn r11601) -Codechange: more strict break conditions for _userstring, assert when it overflows anyway (eg. code change without proper check change)
smatz
parents:
8532
diff
changeset
|
689 |
|
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
690 |
SetDParamStr(0, string); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11045
diff
changeset
|
691 |
return DrawStringMultiLine(str_x, str_y, STR_JUST_RAW_STRING, 144); |
0 | 692 |
} |
693 |
||
9342
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
694 |
/** |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
695 |
* Calculates and draws the accepted or supplied cargo around the selected tile(s) |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
696 |
* @param sx x position where the string is to be drawn |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
697 |
* @param sy y position where the string is to be drawn |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
698 |
* @param sct which type of cargo is to be displayed (passengers/non-passengers) |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
699 |
* @param rad radius around selected tile(s) to be searched |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
700 |
* @param supplies if supplied cargos should be drawn, else accepted cargos |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
701 |
* @return Returns the y value below the string that was drawn |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
702 |
*/ |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
703 |
int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad, bool supplies) |
7817
f24498d934ac
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents:
7762
diff
changeset
|
704 |
{ |
2873 | 705 |
TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y); |
9342
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
706 |
AcceptedCargo cargo; |
2873 | 707 |
if (tile < MapSize()) { |
9342
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
708 |
if (supplies) { |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
709 |
GetProductionAroundTiles(cargo, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad); |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
710 |
} else { |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
711 |
GetAcceptanceAroundTiles(cargo, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad); |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
712 |
} |
ca61cbfca47a
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
rubidium
parents:
9327
diff
changeset
|
713 |
return sy + DrawStationCoverageText(cargo, sx, sy, sct, supplies); |
0 | 714 |
} |
8919
b627c71f9cc3
(svn r11993) -Fix: Resize station/roadstop/dock/airport construction windows if cargo acceptance list is too long.
peter1138
parents:
8845
diff
changeset
|
715 |
|
b627c71f9cc3
(svn r11993) -Fix: Resize station/roadstop/dock/airport construction windows if cargo acceptance list is too long.
peter1138
parents:
8845
diff
changeset
|
716 |
return sy; |
0 | 717 |
} |
718 |
||
4171 | 719 |
void CheckRedrawStationCoverage(const Window *w) |
0 | 720 |
{ |
2549 | 721 |
if (_thd.dirty & 1) { |
722 |
_thd.dirty &= ~1; |
|
0 | 723 |
SetWindowDirty(w); |
724 |
} |
|
725 |
} |
|
726 |
||
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
727 |
/* Delete a character at the caret position in a text buf. |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
728 |
* If backspace is set, delete the character before the caret, |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
729 |
* else delete the character after it. */ |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
730 |
static void DelChar(Textbuf *tb, bool backspace) |
911
bde79514283f
(svn r1398) -Feature: CTRL+V (Paste) now works on all editboxes. This includes 'Add Server', chat, etc. Feature is Windows only.
darkvater
parents:
910
diff
changeset
|
731 |
{ |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
732 |
WChar c; |
6540
4db000b2cc41
(svn r9011) -Codechange (r9003): Rework Utf8PrevChar so that it returns a pointer to the previous UTF8 character's first byte instead of a byte-length offset
Darkvater
parents:
6537
diff
changeset
|
733 |
char *s = tb->buf + tb->caretpos; |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
734 |
|
6540
4db000b2cc41
(svn r9011) -Codechange (r9003): Rework Utf8PrevChar so that it returns a pointer to the previous UTF8 character's first byte instead of a byte-length offset
Darkvater
parents:
6537
diff
changeset
|
735 |
if (backspace) s = Utf8PrevChar(s); |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
736 |
|
10751
ebd94f2d6385
(svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents:
10703
diff
changeset
|
737 |
uint16 len = (uint16)Utf8Decode(&c, s); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
738 |
uint width = GetCharacterWidth(FS_NORMAL, c); |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
739 |
|
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
740 |
tb->width -= width; |
6540
4db000b2cc41
(svn r9011) -Codechange (r9003): Rework Utf8PrevChar so that it returns a pointer to the previous UTF8 character's first byte instead of a byte-length offset
Darkvater
parents:
6537
diff
changeset
|
741 |
if (backspace) { |
4db000b2cc41
(svn r9011) -Codechange (r9003): Rework Utf8PrevChar so that it returns a pointer to the previous UTF8 character's first byte instead of a byte-length offset
Darkvater
parents:
6537
diff
changeset
|
742 |
tb->caretpos -= len; |
4db000b2cc41
(svn r9011) -Codechange (r9003): Rework Utf8PrevChar so that it returns a pointer to the previous UTF8 character's first byte instead of a byte-length offset
Darkvater
parents:
6537
diff
changeset
|
743 |
tb->caretxoffs -= width; |
4db000b2cc41
(svn r9011) -Codechange (r9003): Rework Utf8PrevChar so that it returns a pointer to the previous UTF8 character's first byte instead of a byte-length offset
Darkvater
parents:
6537
diff
changeset
|
744 |
} |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
745 |
|
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
746 |
/* Move the remaining characters over the marker */ |
6540
4db000b2cc41
(svn r9011) -Codechange (r9003): Rework Utf8PrevChar so that it returns a pointer to the previous UTF8 character's first byte instead of a byte-length offset
Darkvater
parents:
6537
diff
changeset
|
747 |
memmove(s, s + len, tb->length - (s - tb->buf) - len + 1); |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
748 |
tb->length -= len; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
749 |
} |
911
bde79514283f
(svn r1398) -Feature: CTRL+V (Paste) now works on all editboxes. This includes 'Add Server', chat, etc. Feature is Windows only.
darkvater
parents:
910
diff
changeset
|
750 |
|
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
751 |
/** |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
752 |
* Delete a character from a textbuffer, either with 'Delete' or 'Backspace' |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
753 |
* The character is delete from the position the caret is at |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
754 |
* @param tb Textbuf type to be changed |
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
755 |
* @param delmode Type of deletion, either WKC_BACKSPACE or WKC_DELETE |
7868
25b9aad39e4a
(svn r10736) -Fix: Correct all mispellings of 'successful'.
peter1138
parents:
7842
diff
changeset
|
756 |
* @return Return true on successful change of Textbuf, or false otherwise |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
757 |
*/ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
758 |
bool DeleteTextBufferChar(Textbuf *tb, int delmode) |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
759 |
{ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
760 |
if (delmode == WKC_BACKSPACE && tb->caretpos != 0) { |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
761 |
DelChar(tb, true); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
762 |
return true; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
763 |
} else if (delmode == WKC_DELETE && tb->caretpos < tb->length) { |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
764 |
DelChar(tb, false); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
765 |
return true; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
766 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
767 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
768 |
return false; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
769 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
770 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
771 |
/** |
1879
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
772 |
* Delete every character in the textbuffer |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
773 |
* @param tb Textbuf buffer to be emptied |
1879
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
774 |
*/ |
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
775 |
void DeleteTextBufferAll(Textbuf *tb) |
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
776 |
{ |
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
777 |
memset(tb->buf, 0, tb->maxlength); |
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
778 |
tb->length = tb->width = 0; |
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
779 |
tb->caretpos = tb->caretxoffs = 0; |
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
780 |
} |
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
781 |
|
2ccc61e922e2
(svn r2385) - Feature: shortcut CTRL + U that clears the commandline of the current input-box. As requested by Tron.
Darkvater
parents:
1860
diff
changeset
|
782 |
/** |
3459
b78229520bcf
(svn r4302) - Fix: s/maxlength/maxwidth of course, the buffer size is always set. Comment-change only
Darkvater
parents:
3458
diff
changeset
|
783 |
* Insert a character to a textbuffer. If maxwidth of the Textbuf is zero, |
b78229520bcf
(svn r4302) - Fix: s/maxlength/maxwidth of course, the buffer size is always set. Comment-change only
Darkvater
parents:
3458
diff
changeset
|
784 |
* we don't care about the visual-length but only about the physical |
3458
d3a6ddfa6784
(svn r4301) - Fix: the maxlength parameter of Textbuf is supposed to be the size of the buffer (so length of string + '\0'), but in the code it was a mix of both. It didn't cause any problems though, only an occasionaly one-less character than allowed. (thanks Tron for noticing)
Darkvater
parents:
3421
diff
changeset
|
785 |
* length of the string |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
786 |
* @param tb Textbuf type to be changed |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
787 |
* @param key Character to be inserted |
7868
25b9aad39e4a
(svn r10736) -Fix: Correct all mispellings of 'successful'.
peter1138
parents:
7842
diff
changeset
|
788 |
* @return Return true on successful change of Textbuf, or false otherwise |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
789 |
*/ |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
790 |
bool InsertTextBufferChar(Textbuf *tb, WChar key) |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
791 |
{ |
3798
37a2090eac94
(svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
peter1138
parents:
3719
diff
changeset
|
792 |
const byte charwidth = GetCharacterWidth(FS_NORMAL, key); |
10751
ebd94f2d6385
(svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents:
10703
diff
changeset
|
793 |
uint16 len = (uint16)Utf8CharLen(key); |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
794 |
if (tb->length < (tb->maxlength - len) && (tb->maxwidth == 0 || tb->width + charwidth <= tb->maxwidth)) { |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
795 |
memmove(tb->buf + tb->caretpos + len, tb->buf + tb->caretpos, tb->length - tb->caretpos + 1); |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
796 |
Utf8Encode(tb->buf + tb->caretpos, key); |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
797 |
tb->length += len; |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
798 |
tb->width += charwidth; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
799 |
|
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
800 |
tb->caretpos += len; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
801 |
tb->caretxoffs += charwidth; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
802 |
return true; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
803 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
804 |
return false; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
805 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
806 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
807 |
/** |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
808 |
* Handle text navigation with arrow keys left/right. |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
809 |
* This defines where the caret will blink and the next characer interaction will occur |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
810 |
* @param tb Textbuf type where navigation occurs |
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
811 |
* @param navmode Direction in which navigation occurs WKC_LEFT, WKC_RIGHT, WKC_END, WKC_HOME |
7868
25b9aad39e4a
(svn r10736) -Fix: Correct all mispellings of 'successful'.
peter1138
parents:
7842
diff
changeset
|
812 |
* @return Return true on successful change of Textbuf, or false otherwise |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
813 |
*/ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
814 |
bool MoveTextBufferPos(Textbuf *tb, int navmode) |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
815 |
{ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
816 |
switch (navmode) { |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
817 |
case WKC_LEFT: |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
818 |
if (tb->caretpos != 0) { |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
819 |
WChar c; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
820 |
const char *s = Utf8PrevChar(tb->buf + tb->caretpos); |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
821 |
Utf8Decode(&c, s); |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
822 |
tb->caretpos = s - tb->buf; // -= (tb->buf + tb->caretpos - s) |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
823 |
tb->caretxoffs -= GetCharacterWidth(FS_NORMAL, c); |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
824 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
825 |
return true; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
826 |
} |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
827 |
break; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
828 |
|
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
829 |
case WKC_RIGHT: |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
830 |
if (tb->caretpos < tb->length) { |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
831 |
WChar c; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
832 |
|
10751
ebd94f2d6385
(svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
rubidium
parents:
10703
diff
changeset
|
833 |
tb->caretpos += (uint16)Utf8Decode(&c, tb->buf + tb->caretpos); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
834 |
tb->caretxoffs += GetCharacterWidth(FS_NORMAL, c); |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
835 |
|
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
836 |
return true; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
837 |
} |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
838 |
break; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
839 |
|
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
840 |
case WKC_HOME: |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
841 |
tb->caretpos = 0; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
842 |
tb->caretxoffs = 0; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
843 |
return true; |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
844 |
|
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
845 |
case WKC_END: |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
846 |
tb->caretpos = tb->length; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
847 |
tb->caretxoffs = tb->width; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
848 |
return true; |
9315 | 849 |
|
850 |
default: |
|
851 |
break; |
|
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
852 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
853 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
854 |
return false; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
855 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
856 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
857 |
/** |
4948
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
858 |
* Initialize the textbuffer by supplying it the buffer to write into |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
859 |
* and the maximum length of this buffer |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
860 |
* @param tb Textbuf type which is getting initialized |
4948
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
861 |
* @param buf the buffer that will be holding the data for input |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
862 |
* @param maxlength maximum length in characters of this buffer |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
863 |
* @param maxwidth maximum length in pixels of this buffer. If reached, buffer |
4958 | 864 |
* cannot grow, even if maxlength would allow because there is space. A length |
865 |
* of zero '0' means the buffer is only restricted by maxlength */ |
|
4948
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
866 |
void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth) |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
867 |
{ |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
868 |
tb->buf = (char*)buf; |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
869 |
tb->maxlength = maxlength; |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
870 |
tb->maxwidth = maxwidth; |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
871 |
tb->caret = true; |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
872 |
UpdateTextBufferSize(tb); |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
873 |
} |
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
874 |
|
91dae24f3690
(svn r6937) -Codechange: Add an InitializeTextBuffer() function that handles setting up the
Darkvater
parents:
4939
diff
changeset
|
875 |
/** |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
876 |
* Update Textbuf type with its actual physical character and screenlength |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
877 |
* Get the count of characters in the string as well as the width in pixels. |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
878 |
* Useful when copying in a larger amount of text at once |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
879 |
* @param tb Textbuf type which length is calculated |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
880 |
*/ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
881 |
void UpdateTextBufferSize(Textbuf *tb) |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
882 |
{ |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
883 |
const char *buf = tb->buf; |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
884 |
WChar c = Utf8Consume(&buf); |
2630 | 885 |
|
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
886 |
tb->width = 0; |
5698
6697ee90a195
(svn r7700) -Fix (r7182): the caret 'randomly' jumped back and forth when getting a new randomised seed in the Generation World GUI.
rubidium
parents:
5682
diff
changeset
|
887 |
tb->length = 0; |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
888 |
|
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
889 |
for (; c != '\0' && tb->length < (tb->maxlength - 1); c = Utf8Consume(&buf)) { |
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5079
diff
changeset
|
890 |
tb->width += GetCharacterWidth(FS_NORMAL, c); |
5698
6697ee90a195
(svn r7700) -Fix (r7182): the caret 'randomly' jumped back and forth when getting a new randomised seed in the Generation World GUI.
rubidium
parents:
5682
diff
changeset
|
891 |
tb->length += Utf8CharLen(c); |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
892 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
893 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
894 |
tb->caretpos = tb->length; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
895 |
tb->caretxoffs = tb->width; |
911
bde79514283f
(svn r1398) -Feature: CTRL+V (Paste) now works on all editboxes. This includes 'Add Server', chat, etc. Feature is Windows only.
darkvater
parents:
910
diff
changeset
|
896 |
} |
bde79514283f
(svn r1398) -Feature: CTRL+V (Paste) now works on all editboxes. This includes 'Add Server', chat, etc. Feature is Windows only.
darkvater
parents:
910
diff
changeset
|
897 |
|
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
898 |
bool HandleCaret(Textbuf *tb) |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
899 |
{ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
900 |
/* caret changed? */ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
901 |
bool b = !!(_caret_timer & 0x20); |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
902 |
|
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
903 |
if (b != tb->caret) { |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
904 |
tb->caret = b; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
905 |
return true; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
906 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
907 |
return false; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
908 |
} |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
909 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
910 |
int QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key, uint16 keycode, Window::EventState &state) |
0 | 911 |
{ |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
912 |
state = Window::ES_HANDLED; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
913 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
914 |
switch (keycode) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
915 |
case WKC_ESC: return 2; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
916 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
917 |
case WKC_RETURN: case WKC_NUM_ENTER: return 1; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
918 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
919 |
case (WKC_CTRL | 'V'): |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
920 |
if (InsertTextBufferClipboard(&this->text)) w->InvalidateWidget(wid); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
921 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
922 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
923 |
case (WKC_CTRL | 'U'): |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
924 |
DeleteTextBufferAll(&this->text); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
925 |
w->InvalidateWidget(wid); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
926 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
927 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
928 |
case WKC_BACKSPACE: case WKC_DELETE: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
929 |
if (DeleteTextBufferChar(&this->text, keycode)) w->InvalidateWidget(wid); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
930 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
931 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
932 |
case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
933 |
if (MoveTextBufferPos(&this->text, keycode)) w->InvalidateWidget(wid); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
934 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
935 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
936 |
default: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
937 |
if (IsValidChar(key, this->afilter)) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
938 |
if (InsertTextBufferChar(&this->text, key)) w->InvalidateWidget(wid); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
939 |
} else { // key wasn't caught. Continue only if standard entry specified |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
940 |
state = (this->afilter == CS_ALPHANUMERAL) ? Window::ES_HANDLED : Window::ES_NOT_HANDLED; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
941 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
942 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
943 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
944 |
return 0; |
0 | 945 |
} |
946 |
||
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
947 |
void QueryString::HandleEditBox(Window *w, int wid) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
948 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
949 |
if (HandleCaret(&this->text)) w->InvalidateWidget(wid); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
950 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
951 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
952 |
void QueryString::DrawEditBox(Window *w, int wid) |
0 | 953 |
{ |
4955
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
954 |
const Widget *wi = &w->widget[wid]; |
0 | 955 |
|
9233
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9211
diff
changeset
|
956 |
assert((wi->type & WWT_MASK) == WWT_EDITBOX); |
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9211
diff
changeset
|
957 |
|
5890
45bd89352147
(svn r8098) -Fix (r6964): For editboxen, always fill the background with black, and not only after a valid call to FillDrawPixelInfo. This solves some graphics glitches with background widget-colour showing through on frequent redraws.
Darkvater
parents:
5847
diff
changeset
|
958 |
GfxFillRect(wi->left + 1, wi->top + 1, wi->right - 1, wi->bottom - 1, 215); |
45bd89352147
(svn r8098) -Fix (r6964): For editboxen, always fill the background with black, and not only after a valid call to FillDrawPixelInfo. This solves some graphics glitches with background widget-colour showing through on frequent redraws.
Darkvater
parents:
5847
diff
changeset
|
959 |
|
9315 | 960 |
DrawPixelInfo dpi; |
961 |
int delta; |
|
962 |
||
4955
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
963 |
/* Limit the drawing of the string inside the widget boundaries */ |
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
964 |
if (!FillDrawPixelInfo(&dpi, |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
965 |
wi->left + 4, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
966 |
wi->top + 1, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
967 |
wi->right - wi->left - 4, |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
968 |
wi->bottom - wi->top - 1)) { |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
969 |
return; |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
970 |
} |
4955
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
971 |
|
9315 | 972 |
DrawPixelInfo *old_dpi = _cur_dpi; |
4955
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
973 |
_cur_dpi = &dpi; |
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
974 |
|
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
975 |
/* We will take the current widget length as maximum width, with a small |
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
976 |
* space reserved at the end for the caret to show */ |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
977 |
const Textbuf *tb = &this->text; |
9315 | 978 |
|
4955
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
979 |
delta = (wi->right - wi->left) - tb->width - 10; |
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
980 |
if (delta > 0) delta = 0; |
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
981 |
|
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
982 |
if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; |
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
983 |
|
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8246
diff
changeset
|
984 |
DoDrawString(tb->buf, delta, 0, TC_YELLOW); |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8246
diff
changeset
|
985 |
if (tb->caret) DoDrawString("_", tb->caretxoffs + delta, 0, TC_WHITE); |
4955
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
986 |
|
e3496ee0e37d
(svn r6954) -Feature: Constrain the drawing of a string inside an editbox to the dimensions of
Darkvater
parents:
4949
diff
changeset
|
987 |
_cur_dpi = old_dpi; |
0 | 988 |
} |
989 |
||
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
990 |
int QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
991 |
{ |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
992 |
return this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
993 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
994 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
995 |
void QueryStringBaseWindow::HandleEditBox(int wid) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
996 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
997 |
this->QueryString::HandleEditBox(this, wid); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
998 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
999 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1000 |
void QueryStringBaseWindow::DrawEditBox(int wid) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1001 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1002 |
this->QueryString::DrawEditBox(this, wid); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1003 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1004 |
|
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1005 |
enum QueryStringWidgets { |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1006 |
QUERY_STR_WIDGET_TEXT = 3, |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1007 |
QUERY_STR_WIDGET_CANCEL, |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1008 |
QUERY_STR_WIDGET_OK |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1009 |
}; |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1010 |
|
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1011 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1012 |
struct QueryStringWindow : public QueryStringBaseWindow |
0 | 1013 |
{ |
10548
c57b2fcc4f26
(svn r13092) -Fix (r13042): don't add a variable in a subclass when the parent class already have it
glx
parents:
10506
diff
changeset
|
1014 |
QueryStringWindow(const WindowDesc *desc, Window *parent) : QueryStringBaseWindow(desc) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1015 |
{ |
10548
c57b2fcc4f26
(svn r13092) -Fix (r13042): don't add a variable in a subclass when the parent class already have it
glx
parents:
10506
diff
changeset
|
1016 |
this->parent = parent; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1017 |
SetBit(_no_scroll, SCROLL_EDIT); |
0 | 1018 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1019 |
this->FindWindowPlacementAndResize(desc); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1020 |
} |
0 | 1021 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1022 |
virtual void OnPaint() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1023 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1024 |
SetDParam(0, this->caption); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10594
diff
changeset
|
1025 |
this->DrawWidgets(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1026 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1027 |
this->DrawEditBox(QUERY_STR_WIDGET_TEXT); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1028 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1029 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1030 |
void OnOk() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1031 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1032 |
if (this->orig == NULL || strcmp(this->text.buf, this->orig) != 0) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1033 |
/* If the parent is NULL, the editbox is handled by general function |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1034 |
* HandleOnEditText */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1035 |
if (this->parent != NULL) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1036 |
this->parent->OnQueryTextFinished(this->text.buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1037 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1038 |
HandleOnEditText(this->text.buf); |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1039 |
} |
10550
71a83bb72535
(svn r13094) -Fix: closing the QueryWindow would always send a 'query has been cancelled message' even when it was not cancelled causing joining passworded servers/companies to fail.
rubidium
parents:
10549
diff
changeset
|
1040 |
this->handled = true; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1041 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1042 |
} |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1043 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1044 |
virtual void OnClick(Point pt, int widget) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1045 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1046 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1047 |
case QUERY_STR_WIDGET_TEXT: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1048 |
ShowOnScreenKeyboard(this, QUERY_STR_WIDGET_TEXT, QUERY_STR_WIDGET_CANCEL, QUERY_STR_WIDGET_OK); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1049 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1050 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1051 |
case QUERY_STR_WIDGET_OK: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1052 |
this->OnOk(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1053 |
/* Fallthrough */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1054 |
case QUERY_STR_WIDGET_CANCEL: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1055 |
delete this; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1056 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1057 |
} |
10486
247d43dfa6f1
(svn r13029) -Codechange: more work in the road to getting the WP macros and byte[WINDOW_CUSTOM_SIZE] removed. This step changes the event handling to work directly on the Window class instead of via a function pointer and big switches while keeping backward compatability while we're rewriting the Windows to the new scheme.
rubidium
parents:
10484
diff
changeset
|
1058 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1059 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1060 |
virtual void OnMouseLoop() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1061 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1062 |
this->HandleEditBox(QUERY_STR_WIDGET_TEXT); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1063 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1064 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1065 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1066 |
{ |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1067 |
EventState state; |
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1068 |
switch (this->HandleEditBoxKey(QUERY_STR_WIDGET_TEXT, key, keycode, state)) { |
10760
89b19ad25e70
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
10755
diff
changeset
|
1069 |
default: NOT_REACHED(); |
89b19ad25e70
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
10755
diff
changeset
|
1070 |
case 0: { |
89b19ad25e70
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
10755
diff
changeset
|
1071 |
Window *osk = FindWindowById(WC_OSK, 0); |
89b19ad25e70
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
10755
diff
changeset
|
1072 |
if (osk != NULL && osk->parent == this) osk->OnInvalidateData(); |
89b19ad25e70
(svn r13310) -Fix: invalidate OSK when parent editbox changes (from keyboard)
smatz
parents:
10755
diff
changeset
|
1073 |
} break; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1074 |
case 1: this->OnOk(); // Enter pressed, confirms change |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1075 |
/* FALL THROUGH */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1076 |
case 2: delete this; break; // ESC pressed, closes window, abandons changes |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1077 |
} |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1078 |
return state; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1079 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1080 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1081 |
~QueryStringWindow() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1082 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1083 |
if (!this->handled && this->parent != NULL) { |
10754
e190e710da4e
(svn r13304) -Fix (r13042): possible double free (showed up in r13092)
smatz
parents:
10751
diff
changeset
|
1084 |
Window *parent = this->parent; |
e190e710da4e
(svn r13304) -Fix (r13042): possible double free (showed up in r13092)
smatz
parents:
10751
diff
changeset
|
1085 |
this->parent = NULL; // so parent doesn't try to delete us again |
e190e710da4e
(svn r13304) -Fix (r13042): possible double free (showed up in r13092)
smatz
parents:
10751
diff
changeset
|
1086 |
parent->OnQueryTextFinished(NULL); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1087 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1088 |
ClrBit(_no_scroll, SCROLL_EDIT); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1089 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1090 |
}; |
0 | 1091 |
|
1092 |
static const Widget _query_string_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1093 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1094 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 259, 0, 13, STR_012D, STR_NULL}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1095 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 259, 14, 29, 0x0, STR_NULL}, |
9233
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9211
diff
changeset
|
1096 |
{ WWT_EDITBOX, RESIZE_NONE, 14, 2, 257, 16, 27, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1097 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 129, 30, 41, STR_012E_CANCEL, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1098 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 130, 259, 30, 41, STR_012F_OK, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
1099 |
{ WIDGETS_END}, |
0 | 1100 |
}; |
1101 |
||
1102 |
static const WindowDesc _query_string_desc = { |
|
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7817
diff
changeset
|
1103 |
190, 219, 260, 42, 260, 42, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6001
diff
changeset
|
1104 |
WC_QUERY_STRING, WC_NONE, |
8515
d0401d967e99
(svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents:
8514
diff
changeset
|
1105 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
0 | 1106 |
_query_string_widgets, |
1107 |
}; |
|
1108 |
||
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1109 |
/** Show a query popup window with a textbox in it. |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1110 |
* @param str StringID for the text shown in the textbox |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1111 |
* @param caption StringID of text shown in caption of querywindow |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1112 |
* @param maxlen maximum length in characters allowed. If bit 12 is set we |
10638
1234ac29df11
(svn r13182) -Doc: add documentation to mostly rail_gui related functions. Patch by Alberth.
rubidium
parents:
10625
diff
changeset
|
1113 |
* will not check the resulting string against to original string to return success |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1114 |
* @param maxwidth maximum width in pixels allowed |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1115 |
* @param parent pointer to a Window that will handle the events (ok/cancel) of this |
10638
1234ac29df11
(svn r13182) -Doc: add documentation to mostly rail_gui related functions. Patch by Alberth.
rubidium
parents:
10625
diff
changeset
|
1116 |
* window. If NULL, results are handled by global function HandleOnEditText |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1117 |
* @param afilter filters out unwanted character input */ |
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5680
diff
changeset
|
1118 |
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter) |
0 | 1119 |
{ |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
1120 |
uint realmaxlen = maxlen & ~0x1000; |
0 | 1121 |
|
1122 |
DeleteWindowById(WC_QUERY_STRING, 0); |
|
1123 |
DeleteWindowById(WC_SAVELOAD, 0); |
|
1124 |
||
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1125 |
QueryStringWindow *w = new QueryStringWindow(&_query_string_desc, parent); |
1386
aa5a172a8431
(svn r1890) Begin to clean up the edit box: Remove one global variable and split the combined edit/original buffer into two
tron
parents:
1363
diff
changeset
|
1126 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1127 |
assert(realmaxlen < lengthof(w->edit_str_buf)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1128 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1129 |
GetString(w->edit_str_buf, str, lastof(w->edit_str_buf)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1130 |
w->edit_str_buf[realmaxlen - 1] = '\0'; |
596
e876d7319634
(svn r1018) -Fix: Buffer overflow in edit box, because we misuse maxlen for a flag..
truelight
parents:
568
diff
changeset
|
1131 |
|
e876d7319634
(svn r1018) -Fix: Buffer overflow in edit box, because we misuse maxlen for a flag..
truelight
parents:
568
diff
changeset
|
1132 |
if (maxlen & 0x1000) { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1133 |
w->orig = NULL; |
1386
aa5a172a8431
(svn r1890) Begin to clean up the edit box: Remove one global variable and split the combined edit/original buffer into two
tron
parents:
1363
diff
changeset
|
1134 |
} else { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1135 |
strecpy(w->orig_str_buf, w->edit_str_buf, lastof(w->orig_str_buf)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1136 |
w->orig = w->orig_str_buf; |
1386
aa5a172a8431
(svn r1890) Begin to clean up the edit box: Remove one global variable and split the combined edit/original buffer into two
tron
parents:
1363
diff
changeset
|
1137 |
} |
0 | 1138 |
|
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8450
diff
changeset
|
1139 |
w->LowerWidget(QUERY_STR_WIDGET_TEXT); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1140 |
w->caption = caption; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1141 |
w->afilter = afilter; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1142 |
InitializeTextBuffer(&w->text, w->edit_str_buf, realmaxlen, maxwidth); |
0 | 1143 |
} |
1144 |
||
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1145 |
|
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1146 |
enum QueryWidgets { |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1147 |
QUERY_WIDGET_CAPTION = 1, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1148 |
QUERY_WIDGET_NO = 3, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1149 |
QUERY_WIDGET_YES |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1150 |
}; |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1151 |
|
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1152 |
/** |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1153 |
* Window used for asking the user a YES/NO question. |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1154 |
*/ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1155 |
struct QueryWindow : public Window { |
10647
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1156 |
QueryCallbackProc *proc; ///< callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' clicked, false otherwise |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1157 |
uint64 params[10]; ///< local copy of _decode_parameters |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1158 |
StringID message; ///< message shown for query window |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1159 |
|
10647
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1160 |
QueryWindow(const WindowDesc *desc, StringID caption, StringID message, Window *parent, QueryCallbackProc *callback) : Window(desc) |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1161 |
{ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1162 |
if (parent == NULL) parent = FindWindowById(WC_MAIN_WINDOW, 0); |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1163 |
this->parent = parent; |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1164 |
this->left = parent->left + (parent->width / 2) - (this->width / 2); |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1165 |
this->top = parent->top + (parent->height / 2) - (this->height / 2); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1166 |
|
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1167 |
/* Create a backup of the variadic arguments to strings because it will be |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1168 |
* overridden pretty often. We will copy these back for drawing */ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1169 |
CopyOutDParam(this->params, 0, lengthof(this->params)); |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1170 |
this->widget[QUERY_WIDGET_CAPTION].data = caption; |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1171 |
this->message = message; |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1172 |
this->proc = callback; |
10498
f198d0a1aab7
(svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents:
10496
diff
changeset
|
1173 |
|
f198d0a1aab7
(svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents:
10496
diff
changeset
|
1174 |
this->FindWindowPlacementAndResize(desc); |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1175 |
} |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1176 |
|
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1177 |
~QueryWindow() |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1178 |
{ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1179 |
if (this->proc != NULL) this->proc(this->parent, false); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1180 |
} |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1181 |
|
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1182 |
virtual void OnPaint() |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1183 |
{ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1184 |
CopyInDParam(0, this->params, lengthof(this->params)); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10594
diff
changeset
|
1185 |
this->DrawWidgets(); |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1186 |
CopyInDParam(0, this->params, lengthof(this->params)); |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1187 |
|
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1188 |
DrawStringMultiCenter(this->width / 2, (this->height / 2) - 10, this->message, this->width - 2); |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1189 |
} |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1190 |
|
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1191 |
virtual void OnClick(Point pt, int widget) |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1192 |
{ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1193 |
switch (widget) { |
10647
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1194 |
case QUERY_WIDGET_YES: { |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1195 |
/* in the Generate New World window, clicking 'Yes' causes |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1196 |
* DeleteNonVitalWindows() to be called - we shouldn't be in a window then */ |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1197 |
QueryCallbackProc *proc = this->proc; |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1198 |
Window *parent = this->parent; |
10755
3661f65e2211
(svn r13305) -Fix (r13039): Confirmation window sent both yes and no answers instead of just yes.
peter1138
parents:
10754
diff
changeset
|
1199 |
/* Prevent the destructor calling the callback function */ |
3661f65e2211
(svn r13305) -Fix (r13039): Confirmation window sent both yes and no answers instead of just yes.
peter1138
parents:
10754
diff
changeset
|
1200 |
this->proc = NULL; |
10647
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1201 |
delete this; |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1202 |
if (proc != NULL) { |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1203 |
proc(parent, true); |
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1204 |
proc = NULL; |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1205 |
} |
10647
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1206 |
} break; |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1207 |
case QUERY_WIDGET_NO: |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1208 |
delete this; |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1209 |
break; |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1210 |
} |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1211 |
} |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1212 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1213 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1214 |
{ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1215 |
/* ESC closes the window, Enter confirms the action */ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1216 |
switch (keycode) { |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1217 |
case WKC_RETURN: |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1218 |
case WKC_NUM_ENTER: |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1219 |
if (this->proc != NULL) { |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1220 |
this->proc(this->parent, true); |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1221 |
this->proc = NULL; |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1222 |
} |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1223 |
/* Fallthrough */ |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1224 |
case WKC_ESC: |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1225 |
delete this; |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1226 |
return ES_HANDLED; |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1227 |
} |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1228 |
return ES_NOT_HANDLED; |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1229 |
} |
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1230 |
}; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1231 |
|
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1232 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1233 |
static const Widget _query_widgets[] = { |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1234 |
{ WWT_CLOSEBOX, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1235 |
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 209, 0, 13, STR_NULL, STR_NULL}, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1236 |
{ WWT_PANEL, RESIZE_NONE, 4, 0, 209, 14, 81, 0x0, /*OVERRIDE*/STR_NULL}, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1237 |
{WWT_PUSHTXTBTN, RESIZE_NONE, 3, 20, 90, 62, 73, STR_00C9_NO, STR_NULL}, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1238 |
{WWT_PUSHTXTBTN, RESIZE_NONE, 3, 120, 190, 62, 73, STR_00C8_YES, STR_NULL}, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1239 |
{ WIDGETS_END }, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1240 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1241 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1242 |
static const WindowDesc _query_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7817
diff
changeset
|
1243 |
WDP_CENTER, WDP_CENTER, 210, 82, 210, 82, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6001
diff
changeset
|
1244 |
WC_CONFIRM_POPUP_QUERY, WC_NONE, |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1245 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_DEF_WIDGET | WDF_MODAL, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1246 |
_query_widgets, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1247 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1248 |
|
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1249 |
/** Show a modal confirmation window with standard 'yes' and 'no' buttons |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1250 |
* The window is aligned to the centre of its parent. |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1251 |
* NOTE: You cannot use BindCString as parameter for this window! |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1252 |
* @param caption string shown as window caption |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1253 |
* @param message string that will be shown for the window |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1254 |
* @param parent pointer to parent window, if this pointer is NULL the parent becomes |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
1255 |
* the main window WC_MAIN_WINDOW |
6977
67b989528f3d
(svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas
parents:
6949
diff
changeset
|
1256 |
* @param callback callback function pointer to set in the window descriptor*/ |
10647
51ad0a0c6c17
(svn r13191) -Fix: segfault after confirming query subwindow in the Generate New World window
smatz
parents:
10641
diff
changeset
|
1257 |
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1258 |
{ |
10496
f26b493843d6
(svn r13039) -Codechange: make a class of the Query window.
rubidium
parents:
10490
diff
changeset
|
1259 |
new QueryWindow(&_query_desc, caption, message, parent, callback); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1260 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1261 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1262 |
|
5079
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1263 |
static const Widget _load_dialog_widgets[] = { |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1264 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1265 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 256, 0, 13, STR_NULL, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1266 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 127, 14, 25, STR_SORT_BY_NAME, STR_SORT_ORDER_TIP}, |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1267 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 128, 256, 14, 25, STR_SORT_BY_DATE, STR_SORT_ORDER_TIP}, |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1268 |
{ WWT_PANEL, RESIZE_RIGHT, 14, 0, 256, 26, 47, 0x0, STR_NULL}, |
7842
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1269 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 256, 48, 153, 0x0, STR_NULL}, |
5079
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1270 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 245, 256, 48, 59, SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON}, |
7842
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1271 |
{ WWT_INSET, RESIZE_RB, 14, 2, 243, 50, 151, 0x0, STR_400A_LIST_OF_DRIVES_DIRECTORIES}, |
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1272 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 245, 256, 60, 141, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1273 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 245, 256, 142, 153, 0x0, STR_RESIZE_BUTTON}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1274 |
{ WIDGETS_END}, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1275 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1276 |
|
0 | 1277 |
static const Widget _save_dialog_widgets[] = { |
5079
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1278 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1279 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 256, 0, 13, STR_NULL, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1280 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 127, 14, 25, STR_SORT_BY_NAME, STR_SORT_ORDER_TIP}, |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1281 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 128, 256, 14, 25, STR_SORT_BY_DATE, STR_SORT_ORDER_TIP}, |
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1282 |
{ WWT_PANEL, RESIZE_RIGHT, 14, 0, 256, 26, 47, 0x0, STR_NULL}, |
7842
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1283 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 256, 48, 151, 0x0, STR_NULL}, |
5079
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1284 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 245, 256, 48, 59, SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON}, |
7842
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1285 |
{ WWT_INSET, RESIZE_RB, 14, 2, 243, 50, 150, 0x0, STR_400A_LIST_OF_DRIVES_DIRECTORIES}, |
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1286 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 245, 256, 60, 151, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1287 |
{ WWT_PANEL, RESIZE_RTB, 14, 0, 256, 152, 167, 0x0, STR_NULL}, |
10229
fba3f9fa44d7
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
10225
diff
changeset
|
1288 |
{ WWT_EDITBOX, RESIZE_RTB, 14, 2, 254, 154, 165, STR_SAVE_OSKTITLE, STR_400B_CURRENTLY_SELECTED_NAME}, |
7842
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1289 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 127, 168, 179, STR_4003_DELETE, STR_400C_DELETE_THE_CURRENTLY_SELECTED}, |
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1290 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 128, 244, 168, 179, STR_4002_SAVE, STR_400D_SAVE_THE_CURRENT_GAME_USING}, |
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1291 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 245, 256, 168, 179, 0x0, STR_RESIZE_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
1292 |
{ WIDGETS_END}, |
0 | 1293 |
}; |
1294 |
||
6527
f584ab6d87f8
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6523
diff
changeset
|
1295 |
/* Colors for fios types */ |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8246
diff
changeset
|
1296 |
const TextColour _fios_colors[] = { |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8246
diff
changeset
|
1297 |
TC_LIGHT_BLUE, TC_DARK_GREEN, TC_DARK_GREEN, TC_ORANGE, TC_LIGHT_BROWN, |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8246
diff
changeset
|
1298 |
TC_ORANGE, TC_LIGHT_BROWN, TC_ORANGE, TC_ORANGE, TC_YELLOW |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8246
diff
changeset
|
1299 |
}; |
2261
3f78323707bb
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2255
diff
changeset
|
1300 |
|
6573 | 1301 |
void BuildFileList() |
0 | 1302 |
{ |
1596
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1303 |
_fios_path_changed = true; |
0 | 1304 |
FiosFreeSavegameList(); |
4223
0f9535dda7ed
(svn r5767) - Cleanup: Improve upon the header file mess regarding fios. Move all relevant types from hal.h into fios.h, eliminate the unneccessary passing of a global variable, and extern variables in header files (declare in fios.c and misc_gui.c
Darkvater
parents:
4217
diff
changeset
|
1305 |
|
2549 | 1306 |
switch (_saveload_mode) { |
1307 |
case SLD_NEW_GAME: |
|
1308 |
case SLD_LOAD_SCENARIO: |
|
1309 |
case SLD_SAVE_SCENARIO: |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1310 |
FiosGetScenarioList(_saveload_mode); break; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1311 |
case SLD_LOAD_HEIGHTMAP: |
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1312 |
FiosGetHeightmapList(_saveload_mode); break; |
2549 | 1313 |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1314 |
default: FiosGetSavegameList(_saveload_mode); break; |
2549 | 1315 |
} |
0 | 1316 |
} |
1317 |
||
2100
868d62687c9a
(svn r2610) - Feature: set server map name to the loaded name of the game/scenario. Also truncate where neccessary
Darkvater
parents:
2070
diff
changeset
|
1318 |
static void DrawFiosTexts(uint maxw) |
0 | 1319 |
{ |
1596
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1320 |
static const char *path = NULL; |
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1321 |
static StringID str = STR_4006_UNABLE_TO_READ_DRIVE; |
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1322 |
static uint32 tot = 0; |
0 | 1323 |
|
1596
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1324 |
if (_fios_path_changed) { |
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1325 |
str = FiosGetDescText(&path, &tot); |
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1326 |
_fios_path_changed = false; |
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1327 |
} |
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1328 |
|
c1c439a2d5b2
(svn r2100) - Fix: [1024703]: Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines. Tron + glx (and me)
darkvater
parents:
1594
diff
changeset
|
1329 |
if (str != STR_4006_UNABLE_TO_READ_DRIVE) SetDParam(0, tot); |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8246
diff
changeset
|
1330 |
DrawString(2, 37, str, TC_FROMSTRING); |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8246
diff
changeset
|
1331 |
DoDrawStringTruncated(path, 2, 27, TC_BLACK, maxw); |
0 | 1332 |
} |
1333 |
||
6573 | 1334 |
static void MakeSortedSaveGameList() |
0 | 1335 |
{ |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
1336 |
uint sort_start = 0; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
1337 |
uint sort_end = 0; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
1338 |
|
4171 | 1339 |
/* Directories are always above the files (FIOS_TYPE_DIR) |
1340 |
* Drives (A:\ (windows only) are always under the files (FIOS_TYPE_DRIVE) |
|
1341 |
* Only sort savegames/scenarios, not directories |
|
0 | 1342 |
*/ |
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1343 |
for (const FiosItem *item = _fios_items.Begin(); item != _fios_items.End(); item++) { |
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1344 |
switch (item->type) { |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
1345 |
case FIOS_TYPE_DIR: sort_start++; break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
1346 |
case FIOS_TYPE_PARENT: sort_start++; break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
1347 |
case FIOS_TYPE_DRIVE: sort_end++; break; |
10307
624bb10b4ca8
(svn r12848) -Cleanup/Codechange: Use correct variable types, don't prefix with _ for non-globals, and use implicit enum numbering.
peter1138
parents:
10233
diff
changeset
|
1348 |
default: break; |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
1349 |
} |
0 | 1350 |
} |
1351 |
||
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1352 |
uint s_amount = _fios_items.Length() - sort_start - sort_end; |
9315 | 1353 |
if (s_amount > 0) { |
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1354 |
qsort(_fios_items.Get(sort_start), s_amount, sizeof(FiosItem), compare_FiosItems); |
9315 | 1355 |
} |
0 | 1356 |
} |
1357 |
||
6573 | 1358 |
extern void StartupEngines(); |
1131
21a18a6c1b4b
(svn r1632) -Fix: [1108008] Scenario creation bug; engines are of correct year when scenario is saved
darkvater
parents:
1126
diff
changeset
|
1359 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1360 |
struct SaveLoadWindow : public QueryStringBaseWindow { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1361 |
FiosItem o_dir; |
4000
bab1ebc37da0
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3890
diff
changeset
|
1362 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1363 |
void GenerateFileName() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1364 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1365 |
/* Check if we are not a spectator who wants to generate a name.. |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1366 |
Let's use the name of player #0 for now. */ |
11161
7d0fac8f14cd
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
11157
diff
changeset
|
1367 |
const Player *p = GetPlayer(IsValidPlayerID(_local_player) ? _local_player : PLAYER_FIRST); |
2100
868d62687c9a
(svn r2610) - Feature: set server map name to the loaded name of the game/scenario. Also truncate where neccessary
Darkvater
parents:
2070
diff
changeset
|
1368 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1369 |
SetDParam(0, p->index); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1370 |
SetDParam(1, _date); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1371 |
GetString(this->edit_str_buf, STR_4004, lastof(this->edit_str_buf)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1372 |
SanitizeFilename(this->edit_str_buf); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1373 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1374 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1375 |
SaveLoadWindow(const WindowDesc *desc, SaveLoadDialogMode mode) : QueryStringBaseWindow(desc) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1376 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1377 |
static const StringID saveload_captions[] = { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1378 |
STR_4001_LOAD_GAME, |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1379 |
STR_0298_LOAD_SCENARIO, |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1380 |
STR_4000_SAVE_GAME, |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1381 |
STR_0299_SAVE_SCENARIO, |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1382 |
STR_LOAD_HEIGHTMAP, |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1383 |
}; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1384 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1385 |
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1386 |
SetBit(_no_scroll, SCROLL_SAVE); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1387 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1388 |
/* Use an array to define what will be the current file type being handled |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1389 |
* by current file mode */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1390 |
switch (mode) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1391 |
case SLD_SAVE_GAME: this->GenerateFileName(); break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1392 |
case SLD_SAVE_SCENARIO: strcpy(this->edit_str_buf, "UNNAMED"); break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1393 |
default: break; |
0 | 1394 |
} |
2559
08e648022cb0
(svn r3096) - Feature: 'HOME' icon to saveload dialogs that jumps to the default save/load directory based on the dialog (added icon to openttd.grf, introduced FIOS_TYPE_DIRECT that allows arbitrary directory jumping).
Darkvater
parents:
2549
diff
changeset
|
1395 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1396 |
assert((uint)mode < lengthof(saveload_captions)); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1397 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1398 |
this->widget[1].data = saveload_captions[mode]; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1399 |
this->LowerWidget(7); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1400 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1401 |
this->afilter = CS_ALPHANUMERAL; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1402 |
InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 240); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1403 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1404 |
/* pause is only used in single-player, non-editor mode, non-menu mode. It |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1405 |
* will be unpaused in the WE_DESTROY event handler. */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1406 |
if (_game_mode != GM_MENU && !_networking && _game_mode != GM_EDITOR) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1407 |
if (_pause_game >= 0) DoCommandP(0, 1, 0, NULL, CMD_PAUSE); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1408 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1409 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1410 |
BuildFileList(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1411 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1412 |
ResetObjectToPlace(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1413 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1414 |
o_dir.type = FIOS_TYPE_DIRECT; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1415 |
switch (_saveload_mode) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1416 |
case SLD_SAVE_GAME: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1417 |
case SLD_LOAD_GAME: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1418 |
FioGetDirectory(o_dir.name, lengthof(o_dir.name), SAVE_DIR); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1419 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1420 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1421 |
case SLD_SAVE_SCENARIO: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1422 |
case SLD_LOAD_SCENARIO: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1423 |
FioGetDirectory(o_dir.name, lengthof(o_dir.name), SCENARIO_DIR); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1424 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1425 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1426 |
case SLD_LOAD_HEIGHTMAP: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1427 |
FioGetDirectory(o_dir.name, lengthof(o_dir.name), HEIGHTMAP_DIR); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1428 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1429 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1430 |
default: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1431 |
ttd_strlcpy(o_dir.name, _personal_dir, lengthof(o_dir.name)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1432 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1433 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1434 |
this->vscroll.cap = 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1435 |
this->resize.step_width = 2; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1436 |
this->resize.step_height = 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1437 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1438 |
this->FindWindowPlacementAndResize(desc); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1439 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1440 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1441 |
virtual ~SaveLoadWindow() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1442 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1443 |
/* pause is only used in single-player, non-editor mode, non menu mode */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1444 |
if (!_networking && _game_mode != GM_EDITOR && _game_mode != GM_MENU) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1445 |
if (_pause_game >= 0) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1446 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1447 |
FiosFreeSavegameList(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1448 |
ClrBit(_no_scroll, SCROLL_SAVE); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1449 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1450 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1451 |
virtual void OnPaint() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1452 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1453 |
int y; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1454 |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1455 |
SetVScrollCount(this, _fios_items.Length()); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10594
diff
changeset
|
1456 |
this->DrawWidgets(); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1457 |
DrawFiosTexts(this->width); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1458 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1459 |
if (_savegame_sort_dirty) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1460 |
_savegame_sort_dirty = false; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1461 |
MakeSortedSaveGameList(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1462 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1463 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1464 |
GfxFillRect(this->widget[7].left + 1, this->widget[7].top + 1, this->widget[7].right, this->widget[7].bottom, 0xD7); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10594
diff
changeset
|
1465 |
this->DrawSortButtonState(_savegame_sort_order & SORT_BY_NAME ? 2 : 3, _savegame_sort_order & SORT_DESCENDING ? SBS_DOWN : SBS_UP); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1466 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1467 |
y = this->widget[7].top + 1; |
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1468 |
for (uint pos = this->vscroll.pos; pos < _fios_items.Length(); pos++) { |
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1469 |
const FiosItem *item = _fios_items.Get(pos); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1470 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1471 |
DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], this->width - 18); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1472 |
y += 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1473 |
if (y >= this->vscroll.cap * 10 + this->widget[7].top + 1) break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1474 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1475 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1476 |
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1477 |
this->DrawEditBox(10); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1478 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1479 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1480 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1481 |
virtual void OnClick(Point pt, int widget) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1482 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1483 |
switch (widget) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1484 |
case 2: // Sort save names by name |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1485 |
_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ? |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1486 |
SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1487 |
_savegame_sort_dirty = true; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1488 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1489 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1490 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1491 |
case 3: // Sort save names by date |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1492 |
_savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ? |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1493 |
SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1494 |
_savegame_sort_dirty = true; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1495 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1496 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1497 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1498 |
case 6: // OpenTTD 'button', jumps to OpenTTD directory |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1499 |
FiosBrowseTo(&o_dir); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1500 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1501 |
BuildFileList(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1502 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1503 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1504 |
case 7: { // Click the listbox |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1505 |
int y = (pt.y - this->widget[widget].top - 1) / 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1506 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1507 |
if (y < 0 || (y += this->vscroll.pos) >= this->vscroll.count) return; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1508 |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1509 |
const FiosItem *file = _fios_items.Get(y); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1510 |
|
10808
d42b140d24f2
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13
parents:
10775
diff
changeset
|
1511 |
char *name = FiosBrowseTo(file); |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1512 |
if (name != NULL) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1513 |
if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1514 |
_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1515 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1516 |
SetFiosType(file->type); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1517 |
ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1518 |
ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1519 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1520 |
delete this; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1521 |
} else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1522 |
SetFiosType(file->type); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1523 |
ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1524 |
ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1525 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1526 |
delete this; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1527 |
ShowHeightmapLoad(); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1528 |
} else { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1529 |
/* SLD_SAVE_GAME, SLD_SAVE_SCENARIO copy clicked name to editbox */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1530 |
ttd_strlcpy(this->text.buf, file->title, this->text.maxlength); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1531 |
UpdateTextBufferSize(&this->text); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1532 |
this->InvalidateWidget(10); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1533 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1534 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1535 |
/* Changed directory, need repaint. */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1536 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1537 |
BuildFileList(); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1538 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1539 |
break; |
2255
ddcaf9e333ff
(svn r2775) Deleting a file can fail, display an error message when it happens
tron
parents:
2201
diff
changeset
|
1540 |
} |
3288
91b3ed6a0885
(svn r4002) - Fix: Use the title of a savegame in the saveload dialog-editbox. This gets rid of the '.sav' appended to each game as well as properly showing UTF-8 saves when this is implemented. Also don't change the text if the save has failed.
Darkvater
parents:
3287
diff
changeset
|
1541 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1542 |
case 10: // edit box |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1543 |
ShowOnScreenKeyboard(this, widget, 0, 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1544 |
break; |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1545 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1546 |
case 11: case 12: // Delete, Save game |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1547 |
break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1548 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1549 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1550 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1551 |
virtual void OnMouseLoop() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1552 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1553 |
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1554 |
this->HandleEditBox(10); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1555 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1556 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1557 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1558 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1559 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1560 |
if (keycode == WKC_ESC) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1561 |
delete this; |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1562 |
return ES_HANDLED; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1563 |
} |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1564 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1565 |
EventState state = ES_NOT_HANDLED; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1566 |
if ((_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) && |
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1567 |
this->HandleEditBoxKey(10, key, keycode, state) == 1) { // Press Enter |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1568 |
this->HandleButtonClick(12); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1569 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1570 |
|
10607
1ab30cead125
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium
parents:
10595
diff
changeset
|
1571 |
return state; |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1572 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1573 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1574 |
virtual void OnTimeout() |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1575 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1576 |
/* This test protects against using widgets 11 and 12 which are only available |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1577 |
* in those two saveload mode */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1578 |
if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) return; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1579 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1580 |
if (this->IsWidgetLowered(11)) { // Delete button clicked |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1581 |
if (!FiosDelete(this->text.buf)) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1582 |
ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1583 |
} else { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1584 |
BuildFileList(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1585 |
/* Reset file name to current date on successful delete */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1586 |
if (_saveload_mode == SLD_SAVE_GAME) GenerateFileName(); |
9234
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1587 |
} |
8123d1c8e796
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents:
9233
diff
changeset
|
1588 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1589 |
UpdateTextBufferSize(&this->text); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1590 |
this->SetDirty(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1591 |
} else if (this->IsWidgetLowered(12)) { // Save button clicked |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1592 |
_switch_mode = SM_SAVE; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1593 |
FiosMakeSavegameName(_file_to_saveload.name, this->text.buf, sizeof(_file_to_saveload.name)); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1594 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1595 |
/* In the editor set up the vehicle engines correctly (date might have changed) */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1596 |
if (_game_mode == GM_EDITOR) StartupEngines(); |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1597 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
1598 |
} |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1599 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1600 |
virtual void OnResize(Point new_size, Point delta) |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1601 |
{ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1602 |
/* Widget 2 and 3 have to go with halve speed, make it so obiwan */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1603 |
uint diff = delta.x / 2; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1604 |
this->widget[2].right += diff; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1605 |
this->widget[3].left += diff; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1606 |
this->widget[3].right += delta.x; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1607 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1608 |
/* Same for widget 11 and 12 in save-dialog */ |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1609 |
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) { |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1610 |
this->widget[11].right += diff; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1611 |
this->widget[12].left += diff; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1612 |
this->widget[12].right += delta.x; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1613 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1614 |
|
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1615 |
this->vscroll.cap += delta.y / 10; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1616 |
} |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1617 |
}; |
0 | 1618 |
|
1619 |
static const WindowDesc _load_dialog_desc = { |
|
7842
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1620 |
WDP_CENTER, WDP_CENTER, 257, 154, 257, 294, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6001
diff
changeset
|
1621 |
WC_SAVELOAD, WC_NONE, |
8515
d0401d967e99
(svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents:
8514
diff
changeset
|
1622 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
5079
173056d957f5
(svn r7143) -CodeChange: remove redondancy in saveload dialogs
glx
parents:
5070
diff
changeset
|
1623 |
_load_dialog_widgets, |
0 | 1624 |
}; |
1625 |
||
1626 |
static const WindowDesc _save_dialog_desc = { |
|
7842
60f0ca823a73
(svn r10709) -Codechange: allow automatic downsizing of the load game/save game windows. These windows also already supported downsizing, but again the resize button would be unreachable.
rubidium
parents:
7837
diff
changeset
|
1627 |
WDP_CENTER, WDP_CENTER, 257, 180, 257, 320, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6001
diff
changeset
|
1628 |
WC_SAVELOAD, WC_NONE, |
8515
d0401d967e99
(svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents:
8514
diff
changeset
|
1629 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
0 | 1630 |
_save_dialog_widgets, |
1631 |
}; |
|
1632 |
||
8648
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1633 |
/** These values are used to convert the file/operations mode into a corresponding file type. |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1634 |
* So each entry, as expressed by the related comment, is based on the enum */ |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1635 |
static const FileType _file_modetotype[] = { |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1636 |
FT_SAVEGAME, ///< used for SLD_LOAD_GAME |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1637 |
FT_SCENARIO, ///< used for SLD_LOAD_SCENARIO |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1638 |
FT_SAVEGAME, ///< used for SLD_SAVE_GAME |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1639 |
FT_SCENARIO, ///< used for SLD_SAVE_SCENARIO |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1640 |
FT_HEIGHTMAP, ///< used for SLD_LOAD_HEIGHTMAP |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1641 |
FT_SAVEGAME, ///< SLD_NEW_GAME |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1642 |
}; |
daa3c9e931ab
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
belugas
parents:
8645
diff
changeset
|
1643 |
|
8645
83500ad80b08
(svn r11711) -Codechange: Name the Save Load Dialog Mode enum
belugas
parents:
8640
diff
changeset
|
1644 |
void ShowSaveLoadDialog(SaveLoadDialogMode mode) |
0 | 1645 |
{ |
1646 |
DeleteWindowById(WC_QUERY_STRING, 0); |
|
1647 |
DeleteWindowById(WC_SAVELOAD, 0); |
|
1648 |
||
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1649 |
const WindowDesc *sld; |
1397
b04402b901cd
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1392
diff
changeset
|
1650 |
switch (mode) { |
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1651 |
case SLD_SAVE_GAME: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1652 |
case SLD_SAVE_SCENARIO: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1653 |
sld = &_save_dialog_desc; break; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1654 |
default: |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1655 |
sld = &_load_dialog_desc; break; |
1397
b04402b901cd
(svn r1901) - Fix: unwanted behaviour of the savegame dialog, as well as a bug with a sloppy termination of a string. When any editbox is open, scrolling is disabled. If any new types of editboxes come up, please use SET/CLRBIT of _no_scroll with its unique identifier (ttd.h)
Darkvater
parents:
1392
diff
changeset
|
1656 |
} |
0 | 1657 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1658 |
_saveload_mode = mode; |
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1659 |
_file_to_saveload.filetype = _file_modetotype[mode]; |
0 | 1660 |
|
10499
9c2d9bdea61a
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents:
10498
diff
changeset
|
1661 |
new SaveLoadWindow(sld, mode); |
0 | 1662 |
} |
1663 |
||
6573 | 1664 |
void RedrawAutosave() |
0 | 1665 |
{ |
1666 |
SetWindowDirty(FindWindowById(WC_STATUS_BAR, 0)); |
|
1667 |
} |
|
1668 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
1669 |
void SetFiosType(const byte fiostype) |
0 | 1670 |
{ |
1671 |
switch (fiostype) { |
|
2549 | 1672 |
case FIOS_TYPE_FILE: |
1673 |
case FIOS_TYPE_SCENARIO: |
|
1674 |
_file_to_saveload.mode = SL_LOAD; |
|
1675 |
break; |
|
1676 |
||
1677 |
case FIOS_TYPE_OLDFILE: |
|
1678 |
case FIOS_TYPE_OLD_SCENARIO: |
|
1679 |
_file_to_saveload.mode = SL_OLD_LOAD; |
|
1680 |
break; |
|
1681 |
||
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1682 |
#ifdef WITH_PNG |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1683 |
case FIOS_TYPE_PNG: |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1684 |
_file_to_saveload.mode = SL_PNG; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1685 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1686 |
#endif /* WITH_PNG */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1687 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1688 |
case FIOS_TYPE_BMP: |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1689 |
_file_to_saveload.mode = SL_BMP; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1690 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
1691 |
|
2549 | 1692 |
default: |
1693 |
_file_to_saveload.mode = SL_INVALID; |
|
1694 |
break; |
|
0 | 1695 |
} |
1696 |
} |