author | glx |
Wed, 07 May 2008 14:12:20 +0000 | |
changeset 9131 | d7da7ac0f845 |
parent 9127 | 14f21c5954ee |
child 9132 | e5494664e49b |
permissions | -rw-r--r-- |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
2 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
3 |
/** @file toolbar_gui.cpp Code related to the (main) toolbar. */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
4 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
5 |
#include "stdafx.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
6 |
#include "openttd.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
7 |
#include "gui.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
8 |
#include "window_gui.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
9 |
#include "window_func.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
10 |
#include "viewport_func.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
11 |
#include "command_func.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
12 |
#include "variables.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
13 |
#include "train.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
14 |
#include "roadveh.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
15 |
#include "vehicle_gui.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
16 |
#include "rail_gui.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
17 |
#include "road_gui.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
18 |
#include "date_func.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
19 |
#include "vehicle_func.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
20 |
#include "sound_func.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
21 |
#include "terraform_gui.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
22 |
#include "transparency.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
23 |
#include "strings_func.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
24 |
#include "player_base.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
25 |
#include "player_func.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
26 |
#include "player_gui.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
27 |
#include "settings_type.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
28 |
#include "toolbar_gui.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
29 |
#include "vehicle_base.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
30 |
#include "gfx_func.h" |
8965
29a591456a2f
(svn r12757) -Codechange: move all cheat related stuff from all over the place to a single location.
rubidium
parents:
8726
diff
changeset
|
31 |
#include "cheat_func.h" |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
32 |
#include "transparency_gui.h" |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
33 |
#include "screenshot.h" |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
34 |
#include "newgrf_config.h" |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
35 |
#include "signs_func.h" |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
36 |
#include "fios.h" |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
37 |
#include "functions.h" |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
38 |
#include "console.h" |
8977
288be89be1dc
(svn r12769) -Codechange: some coding style cleanups.
rubidium
parents:
8975
diff
changeset
|
39 |
#include "news_gui.h" |
9127
14f21c5954ee
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
9116
diff
changeset
|
40 |
#include "tilehighlight_func.h" |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
41 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
42 |
#include "network/network.h" |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
43 |
#include "network/network_gui.h" |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
44 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
45 |
#include "table/strings.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
46 |
#include "table/sprites.h" |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
47 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
48 |
static Window *PopupMainToolbMenu(Window *w, uint16 parent_button, StringID base_string, byte item_count, byte disabled_mask); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
49 |
static Window *PopupMainPlayerToolbMenu(Window *w, int main_button, int gray); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
50 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
51 |
RailType _last_built_railtype; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
52 |
RoadType _last_built_roadtype; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
53 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
54 |
static void SelectSignTool() |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
55 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
56 |
if (_cursor.sprite == SPR_CURSOR_SIGN) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
57 |
ResetObjectToPlace(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
58 |
} else { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
59 |
SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, VHM_RECT, WC_MAIN_TOOLBAR, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
60 |
_place_proc = PlaceProc_Sign; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
61 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
62 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
63 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
64 |
/** Returns the position where the toolbar wants the menu to appear. |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
65 |
* Make sure the dropdown is fully visible within the window. |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
66 |
* x + w->left because x is supposed to be the offset of the toolbar-button |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
67 |
* we clicked on and w->left the toolbar window itself. So meaning that |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
68 |
* the default position is aligned with the left side of the clicked button */ |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
69 |
static Point GetToolbarDropdownPos(uint16 parent_button, int width, int height) |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
70 |
{ |
8969
6d1c74e0e2cd
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
8965
diff
changeset
|
71 |
const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
72 |
Point pos; |
8726
0d8a2fdb5bbb
(svn r12402) -Fix: some toolbars didn't seem to show anymore.
rubidium
parents:
8723
diff
changeset
|
73 |
pos.x = w->widget[GB(parent_button, 0, 8)].left; |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
74 |
pos.x = w->left + Clamp(pos.x, 0, w->width - width); |
8726
0d8a2fdb5bbb
(svn r12402) -Fix: some toolbars didn't seem to show anymore.
rubidium
parents:
8723
diff
changeset
|
75 |
pos.y = w->height; |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
76 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
77 |
return pos; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
78 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
79 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
80 |
/* --- Pausing --- */ |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
81 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
82 |
static void ToolbarPauseClick(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
83 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
84 |
if (_networking && !_network_server) return; // only server can pause the game |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
85 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
86 |
if (DoCommandP(0, _pause_game ? 0 : 1, 0, NULL, CMD_PAUSE)) SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
87 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
88 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
89 |
/* --- Fast forwarding --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
90 |
|
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
91 |
static void ToolbarFastForwardClick(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
92 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
93 |
_fast_forward ^= true; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
94 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
95 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
96 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
97 |
/* --- Options button menu --- */ |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
98 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
99 |
static void ToolbarOptionsClick(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
100 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
101 |
uint16 x = 0; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
102 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
103 |
w = PopupMainToolbMenu(w, 2, STR_02C4_GAME_OPTIONS, 14, 0); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
104 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
105 |
if (HasBit(_display_opt, DO_SHOW_TOWN_NAMES)) SetBit(x, 6); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
106 |
if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SetBit(x, 7); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
107 |
if (HasBit(_display_opt, DO_SHOW_SIGNS)) SetBit(x, 8); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
108 |
if (HasBit(_display_opt, DO_WAYPOINTS)) SetBit(x, 9); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
109 |
if (HasBit(_display_opt, DO_FULL_ANIMATION)) SetBit(x, 10); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
110 |
if (HasBit(_display_opt, DO_FULL_DETAIL)) SetBit(x, 11); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
111 |
if (IsTransparencySet(TO_HOUSES)) SetBit(x, 12); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
112 |
if (IsTransparencySet(TO_SIGNS)) SetBit(x, 13); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
113 |
WP(w, menu_d).checked_items = x; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
114 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
115 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
116 |
static void MenuClickSettings(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
117 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
118 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
119 |
case 0: ShowGameOptions(); return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
120 |
case 1: ShowGameDifficulty(); return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
121 |
case 2: ShowPatchesSelection(); return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
122 |
case 3: ShowNewGRFSettings(!_networking, true, true, &_grfconfig); return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
123 |
case 4: ShowTransparencyToolbar(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
124 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
125 |
case 6: ToggleBit(_display_opt, DO_SHOW_TOWN_NAMES); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
126 |
case 7: ToggleBit(_display_opt, DO_SHOW_STATION_NAMES); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
127 |
case 8: ToggleBit(_display_opt, DO_SHOW_SIGNS); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
128 |
case 9: ToggleBit(_display_opt, DO_WAYPOINTS); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
129 |
case 10: ToggleBit(_display_opt, DO_FULL_ANIMATION); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
130 |
case 11: ToggleBit(_display_opt, DO_FULL_DETAIL); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
131 |
case 12: ToggleTransparency(TO_HOUSES); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
132 |
case 13: ToggleTransparency(TO_SIGNS); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
133 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
134 |
MarkWholeScreenDirty(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
135 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
136 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
137 |
/* --- Saving/loading button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
138 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
139 |
static void ToolbarSaveClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
140 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
141 |
PopupMainToolbMenu(w, 3, STR_015C_SAVE_GAME, 4, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
142 |
} |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
143 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
144 |
static void ToolbarScenSaveOrLoad(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
145 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
146 |
PopupMainToolbMenu(w, 3, STR_0292_SAVE_SCENARIO, 6, 0); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
147 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
148 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
149 |
static void MenuClickSaveLoad(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
150 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
151 |
if (_game_mode == GM_EDITOR) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
152 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
153 |
case 0: ShowSaveLoadDialog(SLD_SAVE_SCENARIO); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
154 |
case 1: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
155 |
case 2: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
156 |
case 3: AskExitToGameMenu(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
157 |
case 5: HandleExitGameRequest(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
158 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
159 |
} else { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
160 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
161 |
case 0: ShowSaveLoadDialog(SLD_SAVE_GAME); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
162 |
case 1: ShowSaveLoadDialog(SLD_LOAD_GAME); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
163 |
case 2: AskExitToGameMenu(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
164 |
case 3: HandleExitGameRequest(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
165 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
166 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
167 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
168 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
169 |
/* --- Map button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
170 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
171 |
static void ToolbarMapClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
172 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
173 |
PopupMainToolbMenu(w, 4, STR_02DE_MAP_OF_WORLD, 3, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
174 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
175 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
176 |
static void MenuClickMap(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
177 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
178 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
179 |
case 0: ShowSmallMap(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
180 |
case 1: ShowExtraViewPortWindow(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
181 |
case 2: ShowSignList(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
182 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
183 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
184 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
185 |
static void MenuClickScenMap(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
186 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
187 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
188 |
case 0: ShowSmallMap(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
189 |
case 1: ShowExtraViewPortWindow(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
190 |
case 2: ShowSignList(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
191 |
case 3: ShowTownDirectory(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
192 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
193 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
194 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
195 |
/* --- Town button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
196 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
197 |
static void ToolbarTownClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
198 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
199 |
PopupMainToolbMenu(w, 5, STR_02BB_TOWN_DIRECTORY, 1, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
200 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
201 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
202 |
static void MenuClickTown(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
203 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
204 |
ShowTownDirectory(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
205 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
206 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
207 |
/* --- Subidies button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
208 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
209 |
static void ToolbarSubsidiesClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
210 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
211 |
PopupMainToolbMenu(w, 6, STR_02DD_SUBSIDIES, 1, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
212 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
213 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
214 |
static void MenuClickSubsidies(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
215 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
216 |
ShowSubsidiesList(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
217 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
218 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
219 |
/* --- Stations button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
220 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
221 |
static void ToolbarStationsClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
222 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
223 |
PopupMainPlayerToolbMenu(w, 7, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
224 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
225 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
226 |
static void MenuClickStations(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
227 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
228 |
ShowPlayerStations((PlayerID)index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
229 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
230 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
231 |
/* --- Finances button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
232 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
233 |
static void ToolbarFinancesClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
234 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
235 |
PopupMainPlayerToolbMenu(w, 8, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
236 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
237 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
238 |
static void MenuClickFinances(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
239 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
240 |
ShowPlayerFinances((PlayerID)index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
241 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
242 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
243 |
/* --- Company's button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
244 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
245 |
static void ToolbarPlayersClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
246 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
247 |
PopupMainPlayerToolbMenu(w, 9, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
248 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
249 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
250 |
static void MenuClickCompany(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
251 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
252 |
if (_networking && index == 0) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
253 |
ShowClientList(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
254 |
} else { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
255 |
if (_networking) index--; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
256 |
ShowPlayerCompany((PlayerID)index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
257 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
258 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
259 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
260 |
/* --- Graphs button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
261 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
262 |
static void ToolbarGraphsClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
263 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
264 |
PopupMainToolbMenu(w, 10, STR_0154_OPERATING_PROFIT_GRAPH, 6, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
265 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
266 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
267 |
static void MenuClickGraphs(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
268 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
269 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
270 |
case 0: ShowOperatingProfitGraph(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
271 |
case 1: ShowIncomeGraph(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
272 |
case 2: ShowDeliveredCargoGraph(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
273 |
case 3: ShowPerformanceHistoryGraph(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
274 |
case 4: ShowCompanyValueGraph(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
275 |
case 5: ShowCargoPaymentRates(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
276 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
277 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
278 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
279 |
/* --- League button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
280 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
281 |
static void ToolbarLeagueClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
282 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
283 |
PopupMainToolbMenu(w, 11, STR_015A_COMPANY_LEAGUE_TABLE, 2, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
284 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
285 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
286 |
static void MenuClickLeague(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
287 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
288 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
289 |
case 0: ShowCompanyLeagueTable(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
290 |
case 1: ShowPerformanceRatingDetail(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
291 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
292 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
293 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
294 |
/* --- Industries button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
295 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
296 |
static void ToolbarIndustryClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
297 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
298 |
/* Disable build-industry menu if we are a spectator */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
299 |
PopupMainToolbMenu(w, 12, STR_INDUSTRY_DIR, 2, (_current_player == PLAYER_SPECTATOR) ? (1 << 1) : 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
300 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
301 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
302 |
static void MenuClickIndustry(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
303 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
304 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
305 |
case 0: ShowIndustryDirectory(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
306 |
case 1: ShowBuildIndustryWindow(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
307 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
308 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
309 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
310 |
/* --- Trains button menu + 1 helper function for all vehicles. --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
311 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
312 |
static void ToolbarVehicleClick(Window *w, VehicleType veh) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
313 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
314 |
const Vehicle *v; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
315 |
int dis = ~0; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
316 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
317 |
FOR_ALL_VEHICLES(v) { |
9053
dbda5b38bcac
(svn r12892) -Fix: too many items in the vehicle toolbars were greyed out.
rubidium
parents:
9014
diff
changeset
|
318 |
if (v->type == veh && v->IsPrimaryVehicle()) ClrBit(dis, v->owner); |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
319 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
320 |
PopupMainPlayerToolbMenu(w, 13 + veh, dis); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
321 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
322 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
323 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
324 |
static void ToolbarTrainClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
325 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
326 |
ToolbarVehicleClick(w, VEH_TRAIN); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
327 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
328 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
329 |
static void MenuClickShowTrains(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
330 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
331 |
ShowVehicleListWindow((PlayerID)index, VEH_TRAIN); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
332 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
333 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
334 |
/* --- Road vehicle button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
335 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
336 |
static void ToolbarRoadClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
337 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
338 |
ToolbarVehicleClick(w, VEH_ROAD); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
339 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
340 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
341 |
static void MenuClickShowRoad(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
342 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
343 |
ShowVehicleListWindow((PlayerID)index, VEH_ROAD); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
344 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
345 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
346 |
/* --- Ship button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
347 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
348 |
static void ToolbarShipClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
349 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
350 |
ToolbarVehicleClick(w, VEH_SHIP); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
351 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
352 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
353 |
static void MenuClickShowShips(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
354 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
355 |
ShowVehicleListWindow((PlayerID)index, VEH_SHIP); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
356 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
357 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
358 |
/* --- Aircraft button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
359 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
360 |
static void ToolbarAirClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
361 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
362 |
ToolbarVehicleClick(w, VEH_AIRCRAFT); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
363 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
364 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
365 |
static void MenuClickShowAir(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
366 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
367 |
ShowVehicleListWindow((PlayerID)index, VEH_AIRCRAFT); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
368 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
369 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
370 |
/* --- Zoom in button --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
371 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
372 |
static void ToolbarZoomInClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
373 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
374 |
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
375 |
w->HandleButtonClick(17); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
376 |
SndPlayFx(SND_15_BEEP); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
377 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
378 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
379 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
380 |
/* --- Zoom out button --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
381 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
382 |
static void ToolbarZoomOutClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
383 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
384 |
if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
385 |
w->HandleButtonClick(18); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
386 |
SndPlayFx(SND_15_BEEP); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
387 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
388 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
389 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
390 |
/* --- Rail button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
391 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
392 |
static void ToolbarBuildRailClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
393 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
394 |
const Player *p = GetPlayer(_local_player); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
395 |
Window *w2 = PopupMainToolbMenu(w, 19, STR_1015_RAILROAD_CONSTRUCTION, RAILTYPE_END, ~p->avail_railtypes); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
396 |
WP(w2, menu_d).sel_index = _last_built_railtype; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
397 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
398 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
399 |
static void MenuClickBuildRail(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
400 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
401 |
_last_built_railtype = (RailType)index; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
402 |
ShowBuildRailToolbar(_last_built_railtype, -1); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
403 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
404 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
405 |
/* --- Road button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
406 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
407 |
static void ToolbarBuildRoadClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
408 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
409 |
const Player *p = GetPlayer(_local_player); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
410 |
/* The standard road button is *always* available */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
411 |
Window *w2 = PopupMainToolbMenu(w, 20, STR_180A_ROAD_CONSTRUCTION, 2, ~(p->avail_roadtypes | ROADTYPES_ROAD)); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
412 |
WP(w2, menu_d).sel_index = _last_built_roadtype; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
413 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
414 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
415 |
static void MenuClickBuildRoad(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
416 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
417 |
_last_built_roadtype = (RoadType)index; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
418 |
ShowBuildRoadToolbar(_last_built_roadtype); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
419 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
420 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
421 |
/* --- Water button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
422 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
423 |
static void ToolbarBuildWaterClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
424 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
425 |
PopupMainToolbMenu(w, 21, STR_9800_DOCK_CONSTRUCTION, 1, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
426 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
427 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
428 |
static void MenuClickBuildWater(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
429 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
430 |
ShowBuildDocksToolbar(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
431 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
432 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
433 |
/* --- Airport button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
434 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
435 |
static void ToolbarBuildAirClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
436 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
437 |
PopupMainToolbMenu(w, 22, STR_A01D_AIRPORT_CONSTRUCTION, 1, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
438 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
439 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
440 |
static void MenuClickBuildAir(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
441 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
442 |
ShowBuildAirToolbar(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
443 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
444 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
445 |
/* --- Forest button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
446 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
447 |
static void ToolbarForestClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
448 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
449 |
PopupMainToolbMenu(w, 23, STR_LANDSCAPING, 3, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
450 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
451 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
452 |
static void MenuClickForest(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
453 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
454 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
455 |
case 0: ShowTerraformToolbar(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
456 |
case 1: ShowBuildTreesToolbar(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
457 |
case 2: SelectSignTool(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
458 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
459 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
460 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
461 |
/* --- Music button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
462 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
463 |
static void ToolbarMusicClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
464 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
465 |
PopupMainToolbMenu(w, 24, STR_01D3_SOUND_MUSIC, 1, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
466 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
467 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
468 |
static void MenuClickMusicWindow(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
469 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
470 |
ShowMusicWindow(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
471 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
472 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
473 |
/* --- Newspaper button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
474 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
475 |
static void ToolbarNewspaperClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
476 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
477 |
PopupMainToolbMenu(w, 25, STR_0200_LAST_MESSAGE_NEWS_REPORT, 3, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
478 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
479 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
480 |
static void MenuClickNewspaper(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
481 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
482 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
483 |
case 0: ShowLastNewsMessage(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
484 |
case 1: ShowMessageOptions(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
485 |
case 2: ShowMessageHistory(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
486 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
487 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
488 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
489 |
/* --- Help button menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
490 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
491 |
static void ToolbarHelpClick(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
492 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
493 |
PopupMainToolbMenu(w, 26, STR_02D5_LAND_BLOCK_INFO, 6, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
494 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
495 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
496 |
static void MenuClickSmallScreenshot() |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
497 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
498 |
SetScreenshotType(SC_VIEWPORT); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
499 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
500 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
501 |
static void MenuClickWorldScreenshot() |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
502 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
503 |
SetScreenshotType(SC_WORLD); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
504 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
505 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
506 |
static void MenuClickHelp(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
507 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
508 |
switch (index) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
509 |
case 0: PlaceLandBlockInfo(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
510 |
case 2: IConsoleSwitch(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
511 |
case 3: MenuClickSmallScreenshot(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
512 |
case 4: MenuClickWorldScreenshot(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
513 |
case 5: ShowAboutWindow(); break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
514 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
515 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
516 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
517 |
/* --- Scenario editor specific handlers. */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
518 |
|
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
519 |
static void ToolbarScenDateBackward(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
520 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
521 |
/* don't allow too fast scrolling */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
522 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
523 |
w->HandleButtonClick(6); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
524 |
w->SetDirty(); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
525 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
526 |
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year - 1, MIN_YEAR, MAX_YEAR); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
527 |
SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
528 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
529 |
_left_button_clicked = false; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
530 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
531 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
532 |
static void ToolbarScenDateForward(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
533 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
534 |
/* don't allow too fast scrolling */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
535 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
536 |
w->HandleButtonClick(7); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
537 |
w->SetDirty(); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
538 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
539 |
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + 1, MIN_YEAR, MAX_YEAR); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
540 |
SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
541 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
542 |
_left_button_clicked = false; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
543 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
544 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
545 |
static void ToolbarScenMapTownDir(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
546 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
547 |
/* Scenario editor button, *hack*hack* use different button to activate */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
548 |
PopupMainToolbMenu(w, 8 | (17 << 8), STR_02DE_MAP_OF_WORLD, 4, 0); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
549 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
550 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
551 |
static void ToolbarScenZoomIn(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
552 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
553 |
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
554 |
w->HandleButtonClick(9); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
555 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
556 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
557 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
558 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
559 |
static void ToolbarScenZoomOut(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
560 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
561 |
if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
562 |
w->HandleButtonClick(10); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
563 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
564 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
565 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
566 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
567 |
static void ToolbarScenGenLand(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
568 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
569 |
w->HandleButtonClick(11); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
570 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
571 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
572 |
ShowEditorTerraformToolbar(); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
573 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
574 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
575 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
576 |
static void ToolbarScenGenTown(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
577 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
578 |
w->HandleButtonClick(12); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
579 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
580 |
ShowBuildTownWindow(); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
581 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
582 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
583 |
static void ToolbarScenGenIndustry(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
584 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
585 |
w->HandleButtonClick(13); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
586 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
587 |
ShowBuildIndustryWindow(); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
588 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
589 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
590 |
static void ToolbarScenBuildRoad(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
591 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
592 |
w->HandleButtonClick(14); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
593 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
594 |
ShowBuildRoadScenToolbar(); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
595 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
596 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
597 |
static void ToolbarScenPlantTrees(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
598 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
599 |
w->HandleButtonClick(15); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
600 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
601 |
ShowBuildTreesScenToolbar(); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
602 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
603 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
604 |
static void ToolbarScenPlaceSign(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
605 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
606 |
w->HandleButtonClick(16); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
607 |
SndPlayFx(SND_15_BEEP); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
608 |
SelectSignTool(); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
609 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
610 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
611 |
static void ToolbarBtn_NULL(Window *w) |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
612 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
613 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
614 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
615 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
616 |
/* --- Toolbar handling for the 'normal' case */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
617 |
|
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
618 |
typedef void ToolbarButtonProc(Window *w); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
619 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
620 |
static ToolbarButtonProc * const _toolbar_button_procs[] = { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
621 |
ToolbarPauseClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
622 |
ToolbarFastForwardClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
623 |
ToolbarOptionsClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
624 |
ToolbarSaveClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
625 |
ToolbarMapClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
626 |
ToolbarTownClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
627 |
ToolbarSubsidiesClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
628 |
ToolbarStationsClick, |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
629 |
ToolbarFinancesClick, |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
630 |
ToolbarPlayersClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
631 |
ToolbarGraphsClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
632 |
ToolbarLeagueClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
633 |
ToolbarIndustryClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
634 |
ToolbarTrainClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
635 |
ToolbarRoadClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
636 |
ToolbarShipClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
637 |
ToolbarAirClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
638 |
ToolbarZoomInClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
639 |
ToolbarZoomOutClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
640 |
ToolbarBuildRailClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
641 |
ToolbarBuildRoadClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
642 |
ToolbarBuildWaterClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
643 |
ToolbarBuildAirClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
644 |
ToolbarForestClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
645 |
ToolbarMusicClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
646 |
ToolbarNewspaperClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
647 |
ToolbarHelpClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
648 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
649 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
650 |
static void MainToolbarWndProc(Window *w, WindowEvent *e) |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
651 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
652 |
switch (e->event) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
653 |
case WE_PAINT: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
654 |
/* Draw brown-red toolbar bg. */ |
8969
6d1c74e0e2cd
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
8965
diff
changeset
|
655 |
GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB2); |
6d1c74e0e2cd
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
8965
diff
changeset
|
656 |
GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT)); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
657 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
658 |
/* If spectator, disable all construction buttons |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
659 |
* ie : Build road, rail, ships, airports and landscaping |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
660 |
* Since enabled state is the default, just disable when needed */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
661 |
w->SetWidgetsDisabledState(_current_player == PLAYER_SPECTATOR, 19, 20, 21, 22, 23, WIDGET_LIST_END); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
662 |
/* disable company list drop downs, if there are no companies */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
663 |
w->SetWidgetsDisabledState(ActivePlayerCount() == 0, 7, 8, 13, 14, 15, 16, WIDGET_LIST_END); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
664 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
665 |
w->SetWidgetDisabledState(19, !CanBuildVehicleInfrastructure(VEH_TRAIN)); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
666 |
w->SetWidgetDisabledState(22, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
667 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
668 |
DrawWindowWidgets(w); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
669 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
670 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
671 |
case WE_CLICK: |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
672 |
if (_game_mode != GM_MENU && !w->IsWidgetDisabled(e->we.click.widget)) _toolbar_button_procs[e->we.click.widget](w); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
673 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
674 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
675 |
case WE_KEYPRESS: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
676 |
switch (e->we.keypress.keycode) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
677 |
case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
678 |
case WKC_F2: ShowGameOptions(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
679 |
case WKC_F3: MenuClickSaveLoad(0); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
680 |
case WKC_F4: ShowSmallMap(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
681 |
case WKC_F5: ShowTownDirectory(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
682 |
case WKC_F6: ShowSubsidiesList(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
683 |
case WKC_F7: ShowPlayerStations(_local_player); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
684 |
case WKC_F8: ShowPlayerFinances(_local_player); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
685 |
case WKC_F9: ShowPlayerCompany(_local_player); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
686 |
case WKC_F10: ShowOperatingProfitGraph(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
687 |
case WKC_F11: ShowCompanyLeagueTable(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
688 |
case WKC_F12: ShowBuildIndustryWindow(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
689 |
case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, VEH_TRAIN); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
690 |
case WKC_SHIFT | WKC_F2: ShowVehicleListWindow(_local_player, VEH_ROAD); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
691 |
case WKC_SHIFT | WKC_F3: ShowVehicleListWindow(_local_player, VEH_SHIP); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
692 |
case WKC_SHIFT | WKC_F4: ShowVehicleListWindow(_local_player, VEH_AIRCRAFT); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
693 |
case WKC_NUM_PLUS: // Fall through |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
694 |
case WKC_EQUALS: // Fall through |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
695 |
case WKC_SHIFT | WKC_EQUALS: // Fall through |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
696 |
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
697 |
case WKC_NUM_MINUS: // Fall through |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
698 |
case WKC_MINUS: // Fall through |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
699 |
case WKC_SHIFT | WKC_MINUS: // Fall through |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
700 |
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
701 |
case WKC_SHIFT | WKC_F7: if (CanBuildVehicleInfrastructure(VEH_TRAIN)) ShowBuildRailToolbar(_last_built_railtype, -1); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
702 |
case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(_last_built_roadtype); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
703 |
case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
704 |
case WKC_SHIFT | WKC_F10: if (CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) ShowBuildAirToolbar(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
705 |
case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
706 |
case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
707 |
case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
708 |
case WKC_CTRL | 'G': MenuClickWorldScreenshot(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
709 |
case WKC_CTRL | WKC_ALT | 'C': if (!_networking) ShowCheatWindow(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
710 |
case 'A': if (CanBuildVehicleInfrastructure(VEH_TRAIN)) ShowBuildRailToolbar(_last_built_railtype, 4); break; // Invoke Autorail |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
711 |
case 'L': ShowTerraformToolbar(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
712 |
case 'M': ShowSmallMap(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
713 |
case 'V': ShowExtraViewPortWindow(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
714 |
default: return; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
715 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
716 |
e->we.keypress.cont = false; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
717 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
718 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
719 |
case WE_PLACE_OBJ: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
720 |
_place_proc(e->we.place.tile); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
721 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
722 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
723 |
case WE_ABORT_PLACE_OBJ: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
724 |
w->RaiseWidget(25); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
725 |
w->SetDirty(); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
726 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
727 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
728 |
case WE_MOUSELOOP: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
729 |
if (w->IsWidgetLowered(0) != !!_pause_game) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
730 |
w->ToggleWidgetLoweredState(0); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
731 |
w->InvalidateWidget(0); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
732 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
733 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
734 |
if (w->IsWidgetLowered(1) != !!_fast_forward) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
735 |
w->ToggleWidgetLoweredState(1); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
736 |
w->InvalidateWidget(1); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
737 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
738 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
739 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
740 |
case WE_RESIZE: { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
741 |
/* There are 27 buttons plus some spacings if the space allows it */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
742 |
uint button_width; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
743 |
uint spacing; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
744 |
if (w->width >= 27 * 22) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
745 |
button_width = 22; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
746 |
spacing = w->width - (27 * button_width); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
747 |
} else { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
748 |
button_width = w->width / 27; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
749 |
spacing = 0; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
750 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
751 |
uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 }; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
752 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
753 |
for (uint i = 0, x = 0, j = 0; i < 27; i++) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
754 |
if (extra_spacing_at[j] == i) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
755 |
j++; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
756 |
uint add = spacing / (lengthof(extra_spacing_at) - j); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
757 |
spacing -= add; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
758 |
x += add; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
759 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
760 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
761 |
w->widget[i].left = x; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
762 |
x += (spacing != 0) ? button_width : (w->width - x) / (27 - i); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
763 |
w->widget[i].right = x - 1; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
764 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
765 |
} break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
766 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
767 |
case WE_TIMEOUT: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
768 |
for (uint i = 2; i < w->widget_count; i++) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
769 |
if (w->IsWidgetLowered(i)) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
770 |
w->RaiseWidget(i); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
771 |
w->InvalidateWidget(i); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
772 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
773 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
774 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
775 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
776 |
case WE_MESSAGE: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
777 |
if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(w, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, 17, 18); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
778 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
779 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
780 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
781 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
782 |
static const Widget _toolb_normal_widgets[] = { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
783 |
{ WWT_IMGBTN, RESIZE_LEFT, 14, 0, 0, 0, 21, SPR_IMG_PAUSE, STR_0171_PAUSE_GAME}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
784 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
785 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SETTINGS, STR_0187_OPTIONS}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
786 |
{ WWT_IMGBTN_2, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SAVE, STR_0172_SAVE_GAME_ABANDON_GAME}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
787 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
788 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SMALLMAP, STR_0174_DISPLAY_MAP}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
789 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_TOWN, STR_0176_DISPLAY_TOWN_DIRECTORY}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
790 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SUBSIDIES, STR_02DC_DISPLAY_SUBSIDIES}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
791 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_COMPANY_LIST, STR_0173_DISPLAY_LIST_OF_COMPANY}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
792 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
793 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_COMPANY_FINANCE, STR_0177_DISPLAY_COMPANY_FINANCES}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
794 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_COMPANY_GENERAL, STR_0178_DISPLAY_COMPANY_GENERAL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
795 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_GRAPHS, STR_0179_DISPLAY_GRAPHS}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
796 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_COMPANY_LEAGUE, STR_017A_DISPLAY_COMPANY_LEAGUE}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
797 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_INDUSTRY, STR_0312_FUND_CONSTRUCTION_OF_NEW}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
798 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
799 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_TRAINLIST, STR_017B_DISPLAY_LIST_OF_COMPANY}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
800 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_TRUCKLIST, STR_017C_DISPLAY_LIST_OF_COMPANY}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
801 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SHIPLIST, STR_017D_DISPLAY_LIST_OF_COMPANY}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
802 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_AIRPLANESLIST, STR_017E_DISPLAY_LIST_OF_COMPANY}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
803 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
804 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
805 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
806 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
807 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_BUILDRAIL, STR_0181_BUILD_RAILROAD_TRACK}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
808 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_BUILDROAD, STR_0182_BUILD_ROADS}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
809 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_BUILDWATER, STR_0183_BUILD_SHIP_DOCKS}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
810 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_BUILDAIR, STR_0184_BUILD_AIRPORTS}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
811 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, // tree icon is 0x2E6 |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
812 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
813 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_MUSIC, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
814 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_MESSAGES, STR_0203_SHOW_LAST_MESSAGE_NEWS}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
815 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_QUERY, STR_0186_LAND_BLOCK_INFORMATION}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
816 |
{ WIDGETS_END}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
817 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
818 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
819 |
static const WindowDesc _toolb_normal_desc = { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
820 |
0, 0, 0, 22, 640, 22, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
821 |
WC_MAIN_TOOLBAR, WC_NONE, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
822 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
823 |
_toolb_normal_widgets, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
824 |
MainToolbarWndProc |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
825 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
826 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
827 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
828 |
/* --- Toolbar handling for the scenario editor */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
829 |
|
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
830 |
static ToolbarButtonProc * const _scen_toolbar_button_procs[] = { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
831 |
ToolbarPauseClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
832 |
ToolbarFastForwardClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
833 |
ToolbarOptionsClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
834 |
ToolbarScenSaveOrLoad, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
835 |
ToolbarBtn_NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
836 |
ToolbarBtn_NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
837 |
ToolbarScenDateBackward, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
838 |
ToolbarScenDateForward, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
839 |
ToolbarScenMapTownDir, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
840 |
ToolbarScenZoomIn, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
841 |
ToolbarScenZoomOut, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
842 |
ToolbarScenGenLand, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
843 |
ToolbarScenGenTown, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
844 |
ToolbarScenGenIndustry, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
845 |
ToolbarScenBuildRoad, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
846 |
ToolbarScenPlantTrees, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
847 |
ToolbarScenPlaceSign, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
848 |
NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
849 |
NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
850 |
NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
851 |
NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
852 |
NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
853 |
NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
854 |
NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
855 |
ToolbarMusicClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
856 |
NULL, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
857 |
ToolbarHelpClick, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
858 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
859 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
860 |
static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
861 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
862 |
switch (e->event) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
863 |
case WE_PAINT: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
864 |
w->SetWidgetDisabledState(6, _patches_newgame.starting_year <= MIN_YEAR); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
865 |
w->SetWidgetDisabledState(7, _patches_newgame.starting_year >= MAX_YEAR); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
866 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
867 |
/* Draw brown-red toolbar bg. */ |
8969
6d1c74e0e2cd
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
8965
diff
changeset
|
868 |
GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB2); |
6d1c74e0e2cd
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
8965
diff
changeset
|
869 |
GfxFillRect(0, 0, w->width - 1, w->height - 1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT)); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
870 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
871 |
DrawWindowWidgets(w); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
872 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
873 |
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
874 |
DrawStringCenteredTruncated(w->widget[6].right, w->widget[7].left, 6, STR_00AF, TC_FROMSTRING); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
875 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
876 |
/* We hide this panel when the toolbar space gets too small */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
877 |
if (w->widget[4].left != w->widget[4].right) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
878 |
DrawStringCenteredTruncated(w->widget[4].left + 1, w->widget[4].right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
879 |
DrawStringCenteredTruncated(w->widget[4].left + 1, w->widget[4].right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
880 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
881 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
882 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
883 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
884 |
case WE_CLICK: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
885 |
if (_game_mode == GM_MENU) return; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
886 |
_scen_toolbar_button_procs[e->we.click.widget](w); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
887 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
888 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
889 |
case WE_KEYPRESS: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
890 |
switch (e->we.keypress.keycode) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
891 |
case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
892 |
case WKC_F2: ShowGameOptions(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
893 |
case WKC_F3: MenuClickSaveLoad(0); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
894 |
case WKC_F4: ToolbarScenGenLand(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
895 |
case WKC_F5: ToolbarScenGenTown(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
896 |
case WKC_F6: ToolbarScenGenIndustry(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
897 |
case WKC_F7: ToolbarScenBuildRoad(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
898 |
case WKC_F8: ToolbarScenPlantTrees(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
899 |
case WKC_F9: ToolbarScenPlaceSign(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
900 |
case WKC_F10: ShowMusicWindow(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
901 |
case WKC_F11: PlaceLandBlockInfo(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
902 |
case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
903 |
case WKC_CTRL | 'G': MenuClickWorldScreenshot(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
904 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
905 |
/* those following are all fall through */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
906 |
case WKC_NUM_PLUS: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
907 |
case WKC_EQUALS: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
908 |
case WKC_SHIFT | WKC_EQUALS: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
909 |
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
910 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
911 |
/* those following are all fall through */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
912 |
case WKC_NUM_MINUS: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
913 |
case WKC_MINUS: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
914 |
case WKC_SHIFT | WKC_MINUS: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
915 |
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
916 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
917 |
case 'L': ShowEditorTerraformToolbar(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
918 |
case 'M': ShowSmallMap(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
919 |
case 'V': ShowExtraViewPortWindow(); break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
920 |
default: return; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
921 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
922 |
e->we.keypress.cont = false; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
923 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
924 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
925 |
case WE_PLACE_OBJ: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
926 |
_place_proc(e->we.place.tile); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
927 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
928 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
929 |
case WE_ABORT_PLACE_OBJ: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
930 |
w->RaiseWidget(25); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
931 |
w->SetDirty(); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
932 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
933 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
934 |
case WE_RESIZE: { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
935 |
/* There are 15 buttons plus some spacings if the space allows it. |
8969
6d1c74e0e2cd
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
8965
diff
changeset
|
936 |
* Furthermore there are two panels of which one is non - essential |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
937 |
* and that one can be removed is the space is too small. */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
938 |
uint buttons_width; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
939 |
uint spacing; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
940 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
941 |
static int normal_min_width = (15 * 22) + (2 * 130); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
942 |
static int one_less_panel_min_width = (15 * 22) + 130; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
943 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
944 |
if (w->width >= one_less_panel_min_width) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
945 |
buttons_width = 15 * 22; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
946 |
spacing = w->width - ((w->width >= normal_min_width) ? normal_min_width : one_less_panel_min_width); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
947 |
} else { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
948 |
buttons_width = w->width - 130; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
949 |
spacing = 0; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
950 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
951 |
uint extra_spacing_at[] = { 3, 4, 7, 8, 10, 16, 0 }; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
952 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
953 |
/* Yes, it defines about 27 widgets for this toolbar */ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
954 |
for (uint i = 0, x = 0, j = 0, b = 0; i < 27; i++) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
955 |
switch (i) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
956 |
case 4: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
957 |
w->widget[i].left = x; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
958 |
if (w->width < normal_min_width) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
959 |
w->widget[i].right = x; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
960 |
j++; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
961 |
continue; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
962 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
963 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
964 |
x += 130; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
965 |
w->widget[i].right = x - 1; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
966 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
967 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
968 |
case 5: { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
969 |
int offset = x - w->widget[i].left; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
970 |
w->widget[i + 1].left += offset; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
971 |
w->widget[i + 1].right += offset; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
972 |
w->widget[i + 2].left += offset; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
973 |
w->widget[i + 2].right += offset; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
974 |
w->widget[i].left = x; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
975 |
x += 130; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
976 |
w->widget[i].right = x - 1; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
977 |
i += 2; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
978 |
} break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
979 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
980 |
default: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
981 |
if (w->widget[i].bottom == 0) continue; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
982 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
983 |
w->widget[i].left = x; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
984 |
x += buttons_width / (15 - b); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
985 |
w->widget[i].right = x - 1; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
986 |
buttons_width -= buttons_width / (15 - b); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
987 |
b++; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
988 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
989 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
990 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
991 |
if (extra_spacing_at[j] == i) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
992 |
j++; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
993 |
uint add = spacing / (lengthof(extra_spacing_at) - j); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
994 |
spacing -= add; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
995 |
x += add; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
996 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
997 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
998 |
} break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
999 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1000 |
case WE_MOUSELOOP: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1001 |
if (w->IsWidgetLowered(0) != !!_pause_game) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1002 |
w->ToggleWidgetLoweredState(0); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
1003 |
w->SetDirty(); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1004 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1005 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1006 |
if (w->IsWidgetLowered(1) != !!_fast_forward) { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1007 |
w->ToggleWidgetLoweredState(1); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
1008 |
w->SetDirty(); |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1009 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1010 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1011 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1012 |
case WE_MESSAGE: |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1013 |
HandleZoomMessage(w, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, 9, 10); |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1014 |
break; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1015 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1016 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1017 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1018 |
static const Widget _toolb_scen_widgets[] = { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1019 |
{ WWT_IMGBTN, RESIZE_LEFT, 14, 0, 0, 0, 21, SPR_IMG_PAUSE, STR_0171_PAUSE_GAME}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1020 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1021 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SETTINGS, STR_0187_OPTIONS}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1022 |
{WWT_IMGBTN_2, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SAVE, STR_0297_SAVE_SCENARIO_LOAD_SCENARIO}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1023 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1024 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 0, 0, 21, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1025 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1026 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 129, 0, 21, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1027 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 3, 14, 5, 16, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1028 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 113, 125, 5, 16, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1029 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1030 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SMALLMAP, STR_0175_DISPLAY_MAP_TOWN_DIRECTORY}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1031 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1032 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1033 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1034 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1035 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_LANDSCAPING, STR_022E_LANDSCAPE_GENERATION}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1036 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_TOWN, STR_022F_TOWN_GENERATION}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1037 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_INDUSTRY, STR_0230_INDUSTRY_GENERATION}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1038 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_BUILDROAD, STR_0231_ROAD_CONSTRUCTION}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1039 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_PLANTTREES, STR_0288_PLANT_TREES}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1040 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_SIGN, STR_0289_PLACE_SIGN}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1041 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1042 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1043 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1044 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1045 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1046 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1047 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1048 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1049 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_MUSIC, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1050 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1051 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 0, 0, 21, SPR_IMG_QUERY, STR_0186_LAND_BLOCK_INFORMATION}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1052 |
{WIDGETS_END}, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1053 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1054 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1055 |
static const WindowDesc _toolb_scen_desc = { |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1056 |
0, 0, 130, 22, 640, 22, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1057 |
WC_MAIN_TOOLBAR, WC_NONE, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1058 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1059 |
_toolb_scen_widgets, |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1060 |
ScenEditToolbarWndProc |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1061 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1062 |
|
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1063 |
/* --- Rendering/handling the drop down menus --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1064 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1065 |
typedef void MenuClickedProc(int index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1066 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1067 |
static MenuClickedProc * const _menu_clicked_procs[] = { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1068 |
NULL, /* 0 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1069 |
NULL, /* 1 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1070 |
MenuClickSettings, /* 2 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1071 |
MenuClickSaveLoad, /* 3 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1072 |
MenuClickMap, /* 4 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1073 |
MenuClickTown, /* 5 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1074 |
MenuClickSubsidies, /* 6 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1075 |
MenuClickStations, /* 7 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1076 |
MenuClickFinances, /* 8 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1077 |
MenuClickCompany, /* 9 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1078 |
MenuClickGraphs, /* 10 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1079 |
MenuClickLeague, /* 11 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1080 |
MenuClickIndustry, /* 12 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1081 |
MenuClickShowTrains, /* 13 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1082 |
MenuClickShowRoad, /* 14 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1083 |
MenuClickShowShips, /* 15 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1084 |
MenuClickShowAir, /* 16 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1085 |
MenuClickScenMap, /* 17 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1086 |
NULL, /* 18 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1087 |
MenuClickBuildRail, /* 19 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1088 |
MenuClickBuildRoad, /* 20 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1089 |
MenuClickBuildWater, /* 21 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1090 |
MenuClickBuildAir, /* 22 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1091 |
MenuClickForest, /* 23 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1092 |
MenuClickMusicWindow, /* 24 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1093 |
MenuClickNewspaper, /* 25 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1094 |
MenuClickHelp, /* 26 */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1095 |
}; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1096 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1097 |
static void MenuWndProc(Window *w, WindowEvent *e) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1098 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1099 |
switch (e->event) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1100 |
case WE_CREATE: |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1101 |
w->widget[0].right = w->width - 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1102 |
break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1103 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1104 |
case WE_PAINT: { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1105 |
byte count = WP(w, menu_d).item_count; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1106 |
byte sel = WP(w, menu_d).sel_index; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1107 |
uint16 chk = WP(w, menu_d).checked_items; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1108 |
StringID string = WP(w, menu_d).string_id; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1109 |
byte dis = WP(w, menu_d).disabled_items; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1110 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1111 |
DrawWindowWidgets(w); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1112 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1113 |
int x = 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1114 |
int y = 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1115 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1116 |
for (; count != 0; count--, string++, sel--) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1117 |
TextColour color = HasBit(dis, 0) ? TC_GREY : (sel == 0) ? TC_WHITE : TC_BLACK; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1118 |
if (sel == 0) GfxFillRect(x, y, x + w->width - 3, y + 9, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1119 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1120 |
if (HasBit(chk, 0)) DrawString(x + 2, y, STR_CHECKMARK, color); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1121 |
DrawString(x + 2, y, string, color); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1122 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1123 |
y += 10; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1124 |
chk >>= 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1125 |
dis >>= 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1126 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1127 |
} break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1128 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1129 |
case WE_DESTROY: { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1130 |
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1131 |
v->RaiseWidget(WP(w, menu_d).main_button); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
1132 |
w->SetDirty(); |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1133 |
return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1134 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1135 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1136 |
case WE_POPUPMENU_SELECT: { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1137 |
int index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1138 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1139 |
if (index < 0) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1140 |
Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1141 |
if (GetWidgetFromPos(w2, e->we.popupmenu.pt.x - w2->left, e->we.popupmenu.pt.y - w2->top) == WP(w, menu_d).main_button) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1142 |
index = WP(w, menu_d).sel_index; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1143 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1144 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1145 |
int action_id = WP(w, menu_d).action_id; |
9115
47ae980bace3
(svn r12975) -Codechange: replace DeleteWindow(w) with delete w.
rubidium
parents:
9053
diff
changeset
|
1146 |
delete w; |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1147 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1148 |
if (index >= 0) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1149 |
assert((uint)index <= lengthof(_menu_clicked_procs)); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1150 |
_menu_clicked_procs[action_id](index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1151 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1152 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1153 |
} break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1154 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1155 |
case WE_POPUPMENU_OVER: { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1156 |
int index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1157 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1158 |
if (index == -1 || index == WP(w, menu_d).sel_index) return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1159 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1160 |
WP(w, menu_d).sel_index = index; |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
1161 |
w->SetDirty(); |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1162 |
return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1163 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1164 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1165 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1166 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1167 |
/* Dynamic widget length determined by toolbar-string length. |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1168 |
* See PopupMainToolbMenu en MenuWndProc */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1169 |
static const Widget _menu_widgets[] = { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1170 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 0, 0, 0, 0x0, STR_NULL}, |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1171 |
{ WIDGETS_END}, |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1172 |
}; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1173 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1174 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1175 |
/** |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1176 |
* Get the maximum length of a given string in a string-list. This is an |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1177 |
* implicit string-list where the ID's are consecutive |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1178 |
* @param base_string StringID of the first string in the list |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1179 |
* @param count amount of StringID's in the list |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1180 |
* @return the length of the longest string |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1181 |
*/ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1182 |
static int GetStringListMaxWidth(StringID base_string, byte count) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1183 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1184 |
char buffer[512]; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1185 |
int width, max_width = 0; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1186 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1187 |
for (byte i = 0; i != count; i++) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1188 |
GetString(buffer, base_string + i, lastof(buffer)); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1189 |
width = GetStringBoundingBox(buffer).width; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1190 |
if (width > max_width) max_width = width; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1191 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1192 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1193 |
return max_width; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1194 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1195 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1196 |
/** |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1197 |
* Show a general dropdown menu. The positioning of the dropdown menu |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1198 |
* defaults to the left side of the parent_button, eg the button that caused |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1199 |
* this window to appear. The only exceptions are when the right side of this |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1200 |
* dropdown would fall outside the main toolbar window, in that case it is |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1201 |
* aligned with the toolbar's right side. |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1202 |
* Since the disable-mask is only 8 bits right now, these dropdowns are |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1203 |
* restricted to 8 items max if any bits of disabled_mask are active. |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1204 |
* @param w Pointer to a window this dropdown menu belongs to. Has no effect |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1205 |
* whatsoever, only graphically for positioning. |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1206 |
* @param parent_button The widget identifier of the button that was clicked for |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1207 |
* this dropdown. The created dropdown then knows what button to raise (button) on |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1208 |
* action and whose function to execute (action). |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1209 |
* It is possible to appoint another button for an action event by setting the |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1210 |
* upper 8 bits of this parameter. If non is set, action is presumed to be the same |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1211 |
* as button. So<br> |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1212 |
* button bits 0 - 7 - widget clicked to get dropdown |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1213 |
* action bits 8 - 15 - function of widget to execute on select (defaults to bits 0 - 7) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1214 |
* @param base_string The first StringID shown in the dropdown list. All others are |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1215 |
* consecutive indeces from the language file. XXX - fix? Use ingame-string tables? |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1216 |
* @param item_count Number of strings in the list, see previous parameter |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1217 |
* @param disabled_mask Bitmask of disabled strings in the list |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1218 |
* @return Return a pointer to the newly created dropdown window */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1219 |
static Window *PopupMainToolbMenu(Window *w, uint16 parent_button, StringID base_string, byte item_count, byte disabled_mask) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1220 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1221 |
assert(disabled_mask == 0 || item_count <= 8); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1222 |
w->LowerWidget(parent_button); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1223 |
w->InvalidateWidget(parent_button); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1224 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1225 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1226 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1227 |
/* Extend the dropdown toolbar to the longest string in the list */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1228 |
int width = max(GetStringListMaxWidth(base_string, item_count) + 6, 140); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1229 |
int height = item_count * 10 + 2; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1230 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1231 |
Point pos = GetToolbarDropdownPos(parent_button, width, height); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1232 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1233 |
w = AllocateWindow(pos.x, pos.y, width, height, MenuWndProc, WC_TOOLBAR_MENU, _menu_widgets); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1234 |
w->widget[0].bottom = item_count * 10 + 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1235 |
w->flags4 &= ~WF_WHITE_BORDER_MASK; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1236 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1237 |
WP(w, menu_d).item_count = item_count; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1238 |
WP(w, menu_d).sel_index = 0; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1239 |
WP(w, menu_d).main_button = GB(parent_button, 0, 8); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1240 |
WP(w, menu_d).action_id = (GB(parent_button, 8, 8) != 0) ? GB(parent_button, 8, 8) : parent_button; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1241 |
WP(w, menu_d).string_id = base_string; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1242 |
WP(w, menu_d).checked_items = 0; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1243 |
WP(w, menu_d).disabled_items = disabled_mask; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1244 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1245 |
_popup_menu_active = true; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1246 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1247 |
SndPlayFx(SND_15_BEEP); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1248 |
return w; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1249 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1250 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1251 |
/* --- Rendering/drawing the player menu --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1252 |
static int GetPlayerIndexFromMenu(int index) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1253 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1254 |
if (index >= 0) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1255 |
const Player *p; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1256 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1257 |
FOR_ALL_PLAYERS(p) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1258 |
if (p->is_active && --index < 0) return p->index; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1259 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1260 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1261 |
return -1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1262 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1263 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1264 |
static void UpdatePlayerMenuHeight(Window *w) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1265 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1266 |
byte num = ActivePlayerCount(); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1267 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1268 |
/* Increase one to fit in PlayerList in the menu when in network */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1269 |
if (_networking && WP(w, menu_d).main_button == 9) num++; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1270 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1271 |
if (WP(w, menu_d).item_count != num) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1272 |
WP(w, menu_d).item_count = num; |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
1273 |
w->SetDirty(); |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1274 |
num = num * 10 + 2; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1275 |
w->height = num; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1276 |
w->widget[0].bottom = w->widget[0].top + num - 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1277 |
w->top = GetToolbarDropdownPos(0, w->width, w->height).y; |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
1278 |
w->SetDirty(); |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1279 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1280 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1281 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1282 |
static void PlayerMenuWndProc(Window *w, WindowEvent *e) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1283 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1284 |
switch (e->event) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1285 |
case WE_PAINT: { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1286 |
UpdatePlayerMenuHeight(w); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1287 |
DrawWindowWidgets(w); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1288 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1289 |
int x = 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1290 |
int y = 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1291 |
int sel = WP(w, menu_d).sel_index; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1292 |
int chk = WP(w, menu_d).checked_items; // let this mean gray items. |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1293 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1294 |
/* 9 = playerlist */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1295 |
if (_networking && WP(w, menu_d).main_button == 9) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1296 |
if (sel == 0) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1297 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1298 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1299 |
DrawString(x + 19, y, STR_NETWORK_CLIENT_LIST, TC_FROMSTRING); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1300 |
y += 10; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1301 |
sel--; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1302 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1303 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1304 |
const Player *p; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1305 |
FOR_ALL_PLAYERS(p) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1306 |
if (p->is_active) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1307 |
if (p->index == sel) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1308 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1309 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1310 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1311 |
DrawPlayerIcon(p->index, x + 2, y + 1); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1312 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1313 |
SetDParam(0, p->index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1314 |
SetDParam(1, p->index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1315 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1316 |
TextColour color = (p->index == sel) ? TC_WHITE : TC_BLACK; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1317 |
if (chk & 1) color = TC_GREY; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1318 |
DrawString(x + 19, y, STR_7021, color); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1319 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1320 |
y += 10; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1321 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1322 |
chk >>= 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1323 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1324 |
} break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1325 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1326 |
case WE_DESTROY: { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1327 |
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1328 |
v->RaiseWidget(WP(w, menu_d).main_button); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
1329 |
w->SetDirty(); |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1330 |
return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1331 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1332 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1333 |
case WE_POPUPMENU_SELECT: { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1334 |
int index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1335 |
int action_id = WP(w, menu_d).action_id; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1336 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1337 |
/* We have a new entry at the top of the list of menu 9 when networking |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1338 |
* so keep that in count */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1339 |
if (_networking && WP(w, menu_d).main_button == 9) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1340 |
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1341 |
} else { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1342 |
index = GetPlayerIndexFromMenu(index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1343 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1344 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1345 |
if (index < 0) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1346 |
Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1347 |
if (GetWidgetFromPos(w2, e->we.popupmenu.pt.x - w2->left, e->we.popupmenu.pt.y - w2->top) == WP(w, menu_d).main_button) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1348 |
index = WP(w, menu_d).sel_index; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1349 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1350 |
|
9115
47ae980bace3
(svn r12975) -Codechange: replace DeleteWindow(w) with delete w.
rubidium
parents:
9053
diff
changeset
|
1351 |
delete w; |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1352 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1353 |
if (index >= 0) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1354 |
assert(index >= 0 && index < 30); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1355 |
_menu_clicked_procs[action_id](index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1356 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1357 |
} break; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1358 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1359 |
case WE_POPUPMENU_OVER: { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1360 |
int index; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1361 |
UpdatePlayerMenuHeight(w); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1362 |
index = GetMenuItemIndex(w, e->we.popupmenu.pt.x, e->we.popupmenu.pt.y); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1363 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1364 |
/* We have a new entry at the top of the list of menu 9 when networking |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1365 |
* so keep that in count */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1366 |
if (_networking && WP(w, menu_d).main_button == 9) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1367 |
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1368 |
} else { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1369 |
index = GetPlayerIndexFromMenu(index); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1370 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1371 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1372 |
if (index == -1 || index == WP(w, menu_d).sel_index) return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1373 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1374 |
WP(w, menu_d).sel_index = index; |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
1375 |
w->SetDirty(); |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1376 |
return; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1377 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1378 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1379 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1380 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1381 |
static const Widget _player_menu_widgets[] = { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1382 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 240, 0, 81, 0x0, STR_NULL}, |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1383 |
{ WIDGETS_END}, |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1384 |
}; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1385 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1386 |
static Window *PopupMainPlayerToolbMenu(Window *w, int main_button, int gray) |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1387 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1388 |
w->LowerWidget(main_button); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1389 |
w->InvalidateWidget(main_button); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1390 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1391 |
DeleteWindowById(WC_TOOLBAR_MENU, 0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1392 |
Point pos = GetToolbarDropdownPos(main_button, 241, 82); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1393 |
w = AllocateWindow(pos.x, pos.y, 241, 82, PlayerMenuWndProc, WC_TOOLBAR_MENU, _player_menu_widgets); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1394 |
w->flags4 &= ~WF_WHITE_BORDER_MASK; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1395 |
WP(w, menu_d).item_count = 0; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1396 |
WP(w, menu_d).sel_index = (_local_player != PLAYER_SPECTATOR) ? _local_player : GetPlayerIndexFromMenu(0); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1397 |
if (_networking && main_button == 9) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1398 |
if (_local_player != PLAYER_SPECTATOR) { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1399 |
WP(w, menu_d).sel_index++; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1400 |
} else { |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1401 |
/* Select client list by default for spectators */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1402 |
WP(w, menu_d).sel_index = 0; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1403 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1404 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1405 |
WP(w, menu_d).action_id = main_button; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1406 |
WP(w, menu_d).main_button = main_button; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1407 |
WP(w, menu_d).checked_items = gray; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1408 |
WP(w, menu_d).disabled_items = 0; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1409 |
_popup_menu_active = true; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1410 |
SndPlayFx(SND_15_BEEP); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1411 |
return w; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1412 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1413 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1414 |
/* --- Allocating the toolbar --- */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1415 |
|
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1416 |
Window *AllocateToolbar() |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1417 |
{ |
9014
2debe412e5b9
(svn r12813) -Fix [FS#1943]: the 'last built railtype' got reset too often.
rubidium
parents:
8977
diff
changeset
|
1418 |
/* Clean old GUI values; railtype is (re)set by rail_gui.cpp */ |
8975
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1419 |
_last_built_roadtype = ROADTYPE_ROAD; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1420 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1421 |
Window *w = AllocateWindowDesc((_game_mode != GM_EDITOR) ? &_toolb_normal_desc : &_toolb_scen_desc); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1422 |
if (w == NULL) return NULL; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1423 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1424 |
CLRBITS(w->flags4, WF_WHITE_BORDER_MASK); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1425 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1426 |
w->SetWidgetDisabledState(0, _networking && !_network_server); // if not server, disable pause button |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1427 |
w->SetWidgetDisabledState(1, _networking); // if networking, disable fast-forward button |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1428 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1429 |
/* 'w' is for sure a WC_MAIN_TOOLBAR */ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1430 |
PositionMainToolbar(w); |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1431 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1432 |
return w; |
8723
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1433 |
} |