author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 9827 | 338aac16d11b |
child 10016 | 8bfe2fe41d86 |
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" |
9336 | 38 |
#include "console_gui.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 |
|
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
48 |
static void PopupMainToolbMenu(Window *parent, uint16 parent_button, StringID base_string, byte item_count, byte disabled_mask = 0, int sel_index = 0, int checked_items = 0); |
9562
045f39514ca3
(svn r13586) -Codechange: Using default parameter, for cases where there are few exceptions.
belugas
parents:
9547
diff
changeset
|
49 |
static void PopupMainPlayerToolbMenu(Window *parent, int main_button, int gray = 0); |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
50 |
static void SplitToolbar(Window *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
|
51 |
|
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
|
52 |
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
|
53 |
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
|
54 |
|
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
55 |
/** This enum gathers properties of both toolbars */ |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
56 |
enum ToolBarProperties { |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
57 |
TBP_BUTTONWIDTH = 22, ///< width of a button |
9604
209bd96fb8dd
(svn r13646) -Change: typos and miss-aligned enum values
belugas
parents:
9602
diff
changeset
|
58 |
TBP_BUTTONHEIGHT = 22, ///< height of a button as well as the toolbars |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
59 |
TBP_DATEPANELWIDTH = 130, ///< used in scenario editor to calculate width of the toolbar. |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
60 |
|
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
61 |
TBP_TOOLBAR_MINBUTTON = 14, ///< references both toolbars |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
62 |
TBP_NORMAL_MAXBUTTON = 19, ///< normal toolbar has this many buttons |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
63 |
TBP_SCENARIO_MAXBUTTON = 16, ///< while the scenario has these |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
64 |
}; |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
65 |
|
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
66 |
enum ToolbarMode { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
67 |
TB_NORMAL, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
68 |
TB_UPPER, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
69 |
TB_LOWER |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
70 |
}; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
71 |
|
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
72 |
enum ToolbarNormalWidgets { |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
73 |
TBN_PAUSE = 0, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
74 |
TBN_FASTFORWARD, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
75 |
TBN_SETTINGS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
76 |
TBN_SAVEGAME, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
77 |
TBN_SMALLMAP, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
78 |
TBN_TOWNDIRECTORY, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
79 |
TBN_SUBSIDIES, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
80 |
TBN_STATIONS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
81 |
TBN_FINANCES, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
82 |
TBN_PLAYERS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
83 |
TBN_GRAPHICS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
84 |
TBN_LEAGUE, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
85 |
TBN_INDUSTRIES, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
86 |
TBN_VEHICLESTART, ///< trains, actually. So following are trucks, boats and planes |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
87 |
TBN_TRAINS = TBN_VEHICLESTART, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
88 |
TBN_ROADVEHS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
89 |
TBN_SHIPS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
90 |
TBN_AIRCRAFTS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
91 |
TBN_ZOOMIN, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
92 |
TBN_ZOOMOUT, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
93 |
TBN_RAILS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
94 |
TBN_ROADS, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
95 |
TBN_WATER, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
96 |
TBN_AIR, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
97 |
TBN_LANDSCAPE, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
98 |
TBN_MUSICSOUND, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
99 |
TBN_NEWSREPORT, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
100 |
TBN_HELP, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
101 |
TBN_SWITCHBAR, ///< only available when toolbar has been split |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
102 |
}; |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
103 |
|
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
104 |
enum ToolbarScenEditorWidgets { |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
105 |
TBSE_PAUSE = 0, |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
106 |
TBSE_FASTFORWARD, |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
107 |
TBSE_SAVESCENARIO = 3, |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
108 |
TBSE_SPACERPANEL, |
9599 | 109 |
TBSE_DATEPANEL, |
9546
ef63aaf13119
(svn r13561) -Codechange: two more enumifications of widgets
belugas
parents:
9545
diff
changeset
|
110 |
TBSE_DATEBACKWARD, |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
111 |
TBSE_DATEFORWARD, |
9547
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
112 |
TBSE_SMALLMAP, |
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
113 |
TBSE_ZOOMIN, |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
114 |
TBSE_ZOOMOUT, |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
115 |
TBSE_LANDGENERATE, |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
116 |
TBSE_TOWNGENERATE, |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
117 |
TBSE_INDUSTRYGENERATE, |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
118 |
TBSE_BUILDROAD, |
9588
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
119 |
TBSE_BUILDDOCKS, |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
120 |
TBSE_PLANTTREES, |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
121 |
TBSE_PLACESIGNS, |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
122 |
}; |
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
123 |
|
9547
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
124 |
/** The idea of this enum is to allow a separation between widget position |
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
125 |
* and _menu_clicked_procs's entry. By shifting, the "action" id is extracted and |
9604
209bd96fb8dd
(svn r13646) -Change: typos and miss-aligned enum values
belugas
parents:
9602
diff
changeset
|
126 |
* kept safe for usage when required. |
9547
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
127 |
* @see ToolbarMenuWindow::OnMouseLoop */ |
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
128 |
enum ScenarioEditorMenuActions { |
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
129 |
SEMA_MAP_CLICK = 17 << 8, |
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
130 |
}; |
d08f7c9092ea
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas
parents:
9546
diff
changeset
|
131 |
|
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
132 |
static ToolbarMode _toolbar_mode; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
133 |
|
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
|
134 |
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
|
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 |
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
|
137 |
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
|
138 |
} 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
|
139 |
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
|
140 |
_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
|
141 |
} |
678648173fcf
(svn r12767) -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 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
143 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
144 |
/** 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
|
145 |
* 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
|
146 |
* 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
|
147 |
* 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
|
148 |
* 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
|
149 |
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
|
150 |
{ |
8969
6d1c74e0e2cd
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
8965
diff
changeset
|
151 |
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
|
152 |
Point pos; |
8726
0d8a2fdb5bbb
(svn r12402) -Fix: some toolbars didn't seem to show anymore.
rubidium
parents:
8723
diff
changeset
|
153 |
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
|
154 |
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
|
155 |
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
|
156 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
157 |
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
|
158 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
159 |
|
9144
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
160 |
/** |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
161 |
* Retrieve the menu item number from a position |
9144
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
162 |
* @param w Window holding the menu items |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
163 |
* @param x X coordinate of the position |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
164 |
* @param y Y coordinate of the position |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
165 |
* @return Index number of the menu item, or \c -1 if no valid selection under position |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
166 |
*/ |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
167 |
static int GetMenuItemIndex(const Window *w, int item_count, int disabled_items) |
9144
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
168 |
{ |
9162
13d4188eab56
(svn r13025) -Codechange: remove the need for two WindowEvents.
rubidium
parents:
9161
diff
changeset
|
169 |
int x = _cursor.pos.x; |
13d4188eab56
(svn r13025) -Codechange: remove the need for two WindowEvents.
rubidium
parents:
9161
diff
changeset
|
170 |
int y = _cursor.pos.y; |
13d4188eab56
(svn r13025) -Codechange: remove the need for two WindowEvents.
rubidium
parents:
9161
diff
changeset
|
171 |
|
9144
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
172 |
if ((x -= w->left) >= 0 && x < w->width && (y -= w->top + 1) >= 0) { |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
173 |
y /= 10; |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
174 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
175 |
if (y < item_count && |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
176 |
!HasBit(disabled_items, y)) { |
9144
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
177 |
return y; |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
178 |
} |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
179 |
} |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
180 |
return -1; |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
181 |
} |
4c8d0193ebe0
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
rubidium
parents:
9142
diff
changeset
|
182 |
|
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
|
183 |
/* --- 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
|
184 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
185 |
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
|
186 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
187 |
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
|
188 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
189 |
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
|
190 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
191 |
|
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
|
192 |
/* --- 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
|
193 |
|
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
|
194 |
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
|
195 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
196 |
_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
|
197 |
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
|
198 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
199 |
|
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
|
200 |
/* --- 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
|
201 |
|
9544
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
202 |
enum OptionMenuEntries { |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
203 |
OME_GAMEOPTIONS = 0, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
204 |
OME_DIFFICULTIES, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
205 |
OME_PATCHES, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
206 |
OME_NEWGRFSETTINGS, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
207 |
OME_TRANSPARENCIES, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
208 |
OME_SHOW_TOWNNAMES = 6, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
209 |
OME_SHOW_STATIONNAMES, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
210 |
OME_SHOW_SIGNS, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
211 |
OME_SHOW_WAYPOINTNAMES, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
212 |
OME_FULL_ANIMATION, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
213 |
OME_FULL_DETAILS, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
214 |
OME_TRANSPARENTBUILDINGS, |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
215 |
OME_SHOW_STATIONSIGNS, |
9566
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
216 |
OME_MENUCOUNT, |
9544
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
217 |
}; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
218 |
|
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
|
219 |
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
|
220 |
{ |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
221 |
uint16 x = 0; |
9544
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
222 |
if (HasBit(_display_opt, DO_SHOW_TOWN_NAMES)) SetBit(x, OME_SHOW_TOWNNAMES); |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
223 |
if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SetBit(x, OME_SHOW_STATIONNAMES); |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
224 |
if (HasBit(_display_opt, DO_SHOW_SIGNS)) SetBit(x, OME_SHOW_SIGNS); |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
225 |
if (HasBit(_display_opt, DO_WAYPOINTS)) SetBit(x, OME_SHOW_WAYPOINTNAMES); |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
226 |
if (HasBit(_display_opt, DO_FULL_ANIMATION)) SetBit(x, OME_FULL_ANIMATION); |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
227 |
if (HasBit(_display_opt, DO_FULL_DETAIL)) SetBit(x, OME_FULL_DETAILS); |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
228 |
if (IsTransparencySet(TO_HOUSES)) SetBit(x, OME_TRANSPARENTBUILDINGS); |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
229 |
if (IsTransparencySet(TO_SIGNS)) SetBit(x, OME_SHOW_STATIONSIGNS); |
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
230 |
|
9566
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
231 |
PopupMainToolbMenu(w, TBN_SETTINGS, STR_02C4_GAME_OPTIONS, OME_MENUCOUNT, 0, 0, x); |
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
|
232 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
233 |
|
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
|
234 |
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
|
235 |
{ |
678648173fcf
(svn r12767) -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 |
switch (index) { |
9544
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
237 |
case OME_GAMEOPTIONS: ShowGameOptions(); return; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
238 |
case OME_DIFFICULTIES: ShowGameDifficulty(); return; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
239 |
case OME_PATCHES: ShowPatchesSelection(); return; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
240 |
case OME_NEWGRFSETTINGS: ShowNewGRFSettings(!_networking, true, true, &_grfconfig); return; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
241 |
case OME_TRANSPARENCIES: ShowTransparencyToolbar(); break; |
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
|
242 |
|
9544
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
243 |
case OME_SHOW_TOWNNAMES: ToggleBit(_display_opt, DO_SHOW_TOWN_NAMES); break; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
244 |
case OME_SHOW_STATIONNAMES: ToggleBit(_display_opt, DO_SHOW_STATION_NAMES); break; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
245 |
case OME_SHOW_SIGNS: ToggleBit(_display_opt, DO_SHOW_SIGNS); break; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
246 |
case OME_SHOW_WAYPOINTNAMES: ToggleBit(_display_opt, DO_WAYPOINTS); break; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
247 |
case OME_FULL_ANIMATION: ToggleBit(_display_opt, DO_FULL_ANIMATION); break; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
248 |
case OME_FULL_DETAILS: ToggleBit(_display_opt, DO_FULL_DETAIL); break; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
249 |
case OME_TRANSPARENTBUILDINGS: ToggleTransparency(TO_HOUSES); break; |
4d54be82ab52
(svn r13559) -Codechange: Enumification of the Options menu items
belugas
parents:
9541
diff
changeset
|
250 |
case OME_SHOW_STATIONSIGNS: ToggleTransparency(TO_SIGNS); break; |
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
|
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 |
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
|
253 |
} |
678648173fcf
(svn r12767) -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 |
|
678648173fcf
(svn r12767) -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 |
/* --- 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
|
256 |
|
9566
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
257 |
enum SaveLoadEditorMenuEntries { |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
258 |
SLEME_SAVE_SCENARIO = 0, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
259 |
SLEME_LOAD_SCENARIO, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
260 |
SLEME_LOAD_HEIGHTMAP, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
261 |
SLEME_EXIT_TOINTRO, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
262 |
SLEME_EXIT_GAME = 5, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
263 |
SLEME_MENUCOUNT, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
264 |
}; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
265 |
|
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
266 |
enum SaveLoadNormalMenuEntries { |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
267 |
SLNME_SAVE_GAME = 0, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
268 |
SLNME_LOAD_GAME, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
269 |
SLNME_EXIT_TOINTRO, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
270 |
SLNME_EXIT_GAME, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
271 |
SLNME_MENUCOUNT, |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
272 |
}; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
273 |
|
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
|
274 |
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
|
275 |
{ |
9566
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
276 |
PopupMainToolbMenu(w, TBN_SAVEGAME, STR_015C_SAVE_GAME, SLNME_MENUCOUNT); |
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
|
277 |
} |
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
|
278 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
279 |
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
|
280 |
{ |
9566
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
281 |
PopupMainToolbMenu(w, TBSE_SAVESCENARIO, STR_0292_SAVE_SCENARIO, SLEME_MENUCOUNT); |
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
|
282 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
283 |
|
9610
a4260e8b9191
(svn r13663) -Codechange: Use a default parameter, hoping to reduce the different signatures of functions in menus
belugas
parents:
9607
diff
changeset
|
284 |
static void MenuClickSaveLoad(int index = 0) |
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
|
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 |
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
|
287 |
switch (index) { |
9566
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
288 |
case SLEME_SAVE_SCENARIO: ShowSaveLoadDialog(SLD_SAVE_SCENARIO); break; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
289 |
case SLEME_LOAD_SCENARIO: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
290 |
case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
291 |
case SLEME_EXIT_TOINTRO: AskExitToGameMenu(); break; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
292 |
case SLEME_EXIT_GAME: HandleExitGameRequest(); break; |
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
|
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 |
} 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
|
295 |
switch (index) { |
9566
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
296 |
case SLNME_SAVE_GAME: ShowSaveLoadDialog(SLD_SAVE_GAME); break; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
297 |
case SLNME_LOAD_GAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
298 |
case SLNME_EXIT_TOINTRO: AskExitToGameMenu(); break; |
c42887131096
(svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas
parents:
9564
diff
changeset
|
299 |
case SLNME_EXIT_GAME: HandleExitGameRequest(); break; |
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
|
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 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
305 |
|
9571
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
306 |
enum MapMenuEntries { |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
307 |
MME_SHOW_SMALLMAP = 0, |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
308 |
MME_SHOW_EXTRAVIEWPORTS, |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
309 |
MME_SHOW_SIGNLISTS, |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
310 |
MME_SHOW_TOWNDIRECTORY, ///< This entry is only used in Editor mode |
9604
209bd96fb8dd
(svn r13646) -Change: typos and miss-aligned enum values
belugas
parents:
9602
diff
changeset
|
311 |
MME_MENUCOUNT_NORMAL = 3, |
209bd96fb8dd
(svn r13646) -Change: typos and miss-aligned enum values
belugas
parents:
9602
diff
changeset
|
312 |
MME_MENUCOUNT_EDITOR = 4, |
9571
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
313 |
}; |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
314 |
|
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
|
315 |
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
|
316 |
{ |
9571
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
317 |
PopupMainToolbMenu(w, TBN_SMALLMAP, STR_02DE_MAP_OF_WORLD, MME_MENUCOUNT_NORMAL); |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
318 |
} |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
319 |
|
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
320 |
static void ToolbarScenMapTownDir(Window *w) |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
321 |
{ |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
322 |
/* Scenario editor button, Use different button to activate. |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
323 |
* This scheme will allow to have an action (SEMA_MAP_CLICK, which is in fact |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
324 |
* an entry in _menu_clicked_procs) while at the same time having a start button |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
325 |
* who is not at the same index as its action |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
326 |
* @see ToolbarMenuWindow::OnMouseLoop */ |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
327 |
PopupMainToolbMenu(w, TBSE_SMALLMAP | SEMA_MAP_CLICK, STR_02DE_MAP_OF_WORLD, MME_MENUCOUNT_EDITOR); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
331 |
{ |
678648173fcf
(svn r12767) -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 |
switch (index) { |
9571
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
333 |
case MME_SHOW_SMALLMAP: ShowSmallMap(); break; |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
334 |
case MME_SHOW_EXTRAVIEWPORTS: ShowExtraViewPortWindow(); break; |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
335 |
case MME_SHOW_SIGNLISTS: ShowSignList(); break; |
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
336 |
case MME_SHOW_TOWNDIRECTORY: if (_game_mode == GM_EDITOR) ShowTownDirectory(); break; |
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
|
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 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
341 |
|
678648173fcf
(svn r12767) -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 |
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
|
343 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
344 |
PopupMainToolbMenu(w, TBN_TOWNDIRECTORY, STR_02BB_TOWN_DIRECTORY, 1); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
348 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
350 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
353 |
|
678648173fcf
(svn r12767) -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 |
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
|
355 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
356 |
PopupMainToolbMenu(w, TBN_SUBSIDIES, STR_02DD_SUBSIDIES, 1); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
360 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
362 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
365 |
|
678648173fcf
(svn r12767) -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 |
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
|
367 |
{ |
9562
045f39514ca3
(svn r13586) -Codechange: Using default parameter, for cases where there are few exceptions.
belugas
parents:
9547
diff
changeset
|
368 |
PopupMainPlayerToolbMenu(w, TBN_STATIONS); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
372 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
374 |
} |
678648173fcf
(svn r12767) -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 |
|
678648173fcf
(svn r12767) -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 |
/* --- 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
|
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 |
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
|
379 |
{ |
9562
045f39514ca3
(svn r13586) -Codechange: Using default parameter, for cases where there are few exceptions.
belugas
parents:
9547
diff
changeset
|
380 |
PopupMainPlayerToolbMenu(w, TBN_FINANCES); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
384 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
386 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
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 |
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
|
391 |
{ |
9562
045f39514ca3
(svn r13586) -Codechange: Using default parameter, for cases where there are few exceptions.
belugas
parents:
9547
diff
changeset
|
392 |
PopupMainPlayerToolbMenu(w, TBN_PLAYERS); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
396 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
398 |
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
|
399 |
} 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
|
400 |
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
|
401 |
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
|
402 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
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 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
|
408 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
409 |
PopupMainToolbMenu(w, TBN_GRAPHICS, STR_0154_OPERATING_PROFIT_GRAPH, (_toolbar_mode == TB_NORMAL) ? 6 : 8); |
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
|
410 |
} |
678648173fcf
(svn r12767) -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 |
|
678648173fcf
(svn r12767) -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 |
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
|
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 |
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
|
415 |
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
|
416 |
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
|
417 |
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
|
418 |
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
|
419 |
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
|
420 |
case 5: ShowCargoPaymentRates(); break; |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
421 |
/* functions for combined graphs/league button */ |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
422 |
case 6: ShowCompanyLeagueTable(); break; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
423 |
case 7: ShowPerformanceRatingDetail(); break; |
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
|
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 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
428 |
|
678648173fcf
(svn r12767) -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 |
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
|
430 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
431 |
PopupMainToolbMenu(w, TBN_LEAGUE, STR_015A_COMPANY_LEAGUE_TABLE, 2); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
435 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
437 |
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
|
438 |
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
|
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 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
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 |
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
|
445 |
{ |
678648173fcf
(svn r12767) -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 |
/* Disable build-industry menu if we are a spectator */ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
447 |
PopupMainToolbMenu(w, TBN_INDUSTRIES, STR_INDUSTRY_DIR, 2, (_current_player == PLAYER_SPECTATOR) ? 2 : 0); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
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 |
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
|
453 |
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
|
454 |
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
|
455 |
} |
678648173fcf
(svn r12767) -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 |
} |
678648173fcf
(svn r12767) -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 |
|
678648173fcf
(svn r12767) -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 |
/* --- 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
|
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 |
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
|
461 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
463 |
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
|
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 |
FOR_ALL_VEHICLES(v) { |
9053
dbda5b38bcac
(svn r12892) -Fix: too many items in the vehicle toolbars were greyed out.
rubidium
parents:
9014
diff
changeset
|
466 |
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
|
467 |
} |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
468 |
PopupMainPlayerToolbMenu(w, TBN_VEHICLESTART + veh, dis); |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
473 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
475 |
} |
678648173fcf
(svn r12767) -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 |
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
|
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 |
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
|
480 |
} |
678648173fcf
(svn r12767) -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 |
/* --- 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
|
483 |
|
678648173fcf
(svn r12767) -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 |
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
|
485 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
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 |
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
|
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 |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
/* --- 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
|
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 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
|
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 |
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
|
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 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
|
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 |
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
|
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 |
/* --- 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
|
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 |
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
|
509 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
511 |
} |
678648173fcf
(svn r12767) -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 |
|
678648173fcf
(svn r12767) -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 |
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
|
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 |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
/* --- 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
|
519 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
520 |
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
|
521 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
522 |
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
9616
9df3e05103fd
(svn r13672) -Fix(r13670): silent warnings that MSVC did not raised. Looks like enums can not be easily matched :(
belugas
parents:
9614
diff
changeset
|
523 |
w->HandleButtonClick((_game_mode == GM_EDITOR) ? (byte)TBSE_ZOOMIN : (byte)TBN_ZOOMIN); |
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
|
524 |
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
|
525 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
526 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
527 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
528 |
/* --- 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
|
529 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
530 |
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
|
531 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
532 |
if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) { |
9616
9df3e05103fd
(svn r13672) -Fix(r13670): silent warnings that MSVC did not raised. Looks like enums can not be easily matched :(
belugas
parents:
9614
diff
changeset
|
533 |
w->HandleButtonClick((_game_mode == GM_EDITOR) ? (byte)TBSE_ZOOMOUT : (byte)TBN_ZOOMOUT); |
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
|
534 |
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
|
535 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
536 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
537 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
538 |
/* --- 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
|
539 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
540 |
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
|
541 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
542 |
const Player *p = GetPlayer(_local_player); |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
543 |
PopupMainToolbMenu(w, TBN_RAILS, STR_1015_RAILROAD_CONSTRUCTION, RAILTYPE_END, ~p->avail_railtypes, _last_built_railtype); |
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
|
544 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
545 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
546 |
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
|
547 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
548 |
_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
|
549 |
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
|
550 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
551 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
552 |
/* --- 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
|
553 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
554 |
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
|
555 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
556 |
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
|
557 |
/* The standard road button is *always* available */ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
558 |
PopupMainToolbMenu(w, TBN_ROADS, STR_180A_ROAD_CONSTRUCTION, 2, ~(p->avail_roadtypes | ROADTYPES_ROAD), _last_built_roadtype); |
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
|
559 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
560 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
561 |
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
|
562 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
563 |
_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
|
564 |
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
|
565 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
566 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
567 |
/* --- 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
|
568 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
569 |
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
|
570 |
{ |
9588
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
571 |
PopupMainToolbMenu(w, TBN_WATER, STR_9800_WATERWAYS_CONSTRUCTION, 1); |
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
|
572 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
573 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
574 |
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
|
575 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
576 |
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
|
577 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
578 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
579 |
/* --- 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
|
580 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
581 |
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
|
582 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
583 |
PopupMainToolbMenu(w, TBN_AIR, STR_A01D_AIRPORT_CONSTRUCTION, 1); |
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
|
584 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
585 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
586 |
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
|
587 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
588 |
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
|
589 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
590 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
591 |
/* --- 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
|
592 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
593 |
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
|
594 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
595 |
PopupMainToolbMenu(w, TBN_LANDSCAPE, STR_LANDSCAPING, 3); |
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
|
596 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
597 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
598 |
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
|
599 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
600 |
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
|
601 |
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
|
602 |
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
|
603 |
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
|
604 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
605 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
606 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
607 |
/* --- 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
|
608 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
609 |
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
|
610 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
611 |
PopupMainToolbMenu(w, TBN_MUSICSOUND, STR_01D3_SOUND_MUSIC, 1); |
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
|
612 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
613 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
614 |
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
|
615 |
{ |
678648173fcf
(svn r12767) -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 |
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
|
617 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
618 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
619 |
/* --- 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
|
620 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
621 |
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
|
622 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
623 |
PopupMainToolbMenu(w, TBN_NEWSREPORT, STR_0200_LAST_MESSAGE_NEWS_REPORT, 3); |
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
|
624 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
625 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
626 |
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
|
627 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
628 |
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
|
629 |
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
|
630 |
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
|
631 |
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
|
632 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
633 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
634 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
635 |
/* --- 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
|
636 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
637 |
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
|
638 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
639 |
PopupMainToolbMenu(w, TBN_HELP, STR_02D5_LAND_BLOCK_INFO, 6); |
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
|
640 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
641 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
642 |
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
|
643 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
644 |
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
|
645 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
646 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
647 |
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
|
648 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
649 |
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
|
650 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
651 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
652 |
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
|
653 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
654 |
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
|
655 |
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
|
656 |
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
|
657 |
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
|
658 |
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
|
659 |
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
|
660 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
661 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
662 |
|
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
663 |
/* --- Switch toolbar button --- */ |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
664 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
665 |
static void ToolbarSwitchClick(Window *w) |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
666 |
{ |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
667 |
if (_toolbar_mode != TB_LOWER) { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
668 |
_toolbar_mode = TB_LOWER; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
669 |
} else { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
670 |
_toolbar_mode = TB_UPPER; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
671 |
} |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
672 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
673 |
SplitToolbar(w); |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
674 |
w->HandleButtonClick(TBN_SWITCHBAR); |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
675 |
SetWindowDirty(w); |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
676 |
SndPlayFx(SND_15_BEEP); |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
677 |
} |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
678 |
|
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
|
679 |
/* --- 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
|
680 |
|
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
|
681 |
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
|
682 |
{ |
e513a23c2797
(svn 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 |
/* 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
|
684 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
685 |
w->HandleButtonClick(TBSE_DATEBACKWARD); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
686 |
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
|
687 |
|
9354
845e07db4549
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
9336
diff
changeset
|
688 |
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year - 1, MIN_YEAR, MAX_YEAR); |
845e07db4549
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
9336
diff
changeset
|
689 |
SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); |
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
|
690 |
} |
e513a23c2797
(svn 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 |
_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
|
692 |
} |
e513a23c2797
(svn 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 |
|
e513a23c2797
(svn 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 |
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
|
695 |
{ |
e513a23c2797
(svn 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 |
/* 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
|
697 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
698 |
w->HandleButtonClick(TBSE_DATEFORWARD); |
9116
f2491d3c321b
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
9115
diff
changeset
|
699 |
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
|
700 |
|
9354
845e07db4549
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
9336
diff
changeset
|
701 |
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + 1, MIN_YEAR, MAX_YEAR); |
845e07db4549
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
9336
diff
changeset
|
702 |
SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); |
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
|
703 |
} |
e513a23c2797
(svn 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 |
_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
|
705 |
} |
e513a23c2797
(svn 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 |
|
e513a23c2797
(svn 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 |
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
|
708 |
{ |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
709 |
w->HandleButtonClick(TBSE_LANDGENERATE); |
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
|
710 |
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
|
711 |
|
e513a23c2797
(svn 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 |
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
|
713 |
} |
e513a23c2797
(svn 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 |
|
e513a23c2797
(svn 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 |
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
|
717 |
{ |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
718 |
w->HandleButtonClick(TBSE_TOWNGENERATE); |
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
|
719 |
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
|
720 |
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
|
721 |
} |
e513a23c2797
(svn 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 |
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
|
724 |
{ |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
725 |
w->HandleButtonClick(TBSE_INDUSTRYGENERATE); |
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 |
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
|
727 |
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
|
728 |
} |
e513a23c2797
(svn 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 |
|
e513a23c2797
(svn 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 |
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
|
731 |
{ |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
732 |
w->HandleButtonClick(TBSE_BUILDROAD); |
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
|
733 |
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
|
734 |
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
|
735 |
} |
e513a23c2797
(svn 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 |
|
9588
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
737 |
static void ToolbarScenBuildDocks(Window *w) |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
738 |
{ |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
739 |
w->HandleButtonClick(TBSE_BUILDDOCKS); |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
740 |
SndPlayFx(SND_15_BEEP); |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
741 |
ShowBuildDocksScenToolbar(); |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
742 |
} |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
743 |
|
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
|
744 |
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
|
745 |
{ |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
746 |
w->HandleButtonClick(TBSE_PLANTTREES); |
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
|
747 |
SndPlayFx(SND_15_BEEP); |
9195
738780fcebc8
(svn r13061) -Codechange: make a class of the BuildTreesWindow.
glx
parents:
9165
diff
changeset
|
748 |
ShowBuildTreesToolbar(); |
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
|
749 |
} |
e513a23c2797
(svn 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 |
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
|
752 |
{ |
9519
e75bc0300488
(svn r13515) -Codechange: Widget enumification for scenario editor
belugas
parents:
9518
diff
changeset
|
753 |
w->HandleButtonClick(TBSE_PLACESIGNS); |
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
|
754 |
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
|
755 |
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
|
756 |
} |
e513a23c2797
(svn 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 |
|
e513a23c2797
(svn 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 |
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
|
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 |
|
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
762 |
/* --- Resizing the toolbar */ |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
763 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
764 |
static void ResizeToolbar(Window *w) |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
765 |
{ |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
766 |
/* There are 27 buttons plus some spacings if the space allows it */ |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
767 |
uint button_width; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
768 |
uint spacing; |
9541
a5e34830f00d
(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"
belugas
parents:
9539
diff
changeset
|
769 |
uint widgetcount = w->widget_count - 1; |
a5e34830f00d
(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"
belugas
parents:
9539
diff
changeset
|
770 |
|
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
771 |
if (w->width >= (int)widgetcount * TBP_BUTTONWIDTH) { |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
772 |
button_width = TBP_BUTTONWIDTH; |
9541
a5e34830f00d
(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"
belugas
parents:
9539
diff
changeset
|
773 |
spacing = w->width - (widgetcount * button_width); |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
774 |
} else { |
9541
a5e34830f00d
(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"
belugas
parents:
9539
diff
changeset
|
775 |
button_width = w->width / widgetcount; |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
776 |
spacing = 0; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
777 |
} |
9538
0507f463f71f
(svn r13542) -Codechange: Less a few more magic numbers and a code a bit more adaptable, still
belugas
parents:
9537
diff
changeset
|
778 |
|
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
779 |
static const uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 }; |
9538
0507f463f71f
(svn r13542) -Codechange: Less a few more magic numbers and a code a bit more adaptable, still
belugas
parents:
9537
diff
changeset
|
780 |
uint i = 0; |
9541
a5e34830f00d
(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"
belugas
parents:
9539
diff
changeset
|
781 |
for (uint x = 0, j = 0; i < widgetcount; i++) { |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
782 |
if (extra_spacing_at[j] == i) { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
783 |
j++; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
784 |
uint add = spacing / (lengthof(extra_spacing_at) - j); |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
785 |
spacing -= add; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
786 |
x += add; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
787 |
} |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
788 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
789 |
w->widget[i].type = WWT_IMGBTN; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
790 |
w->widget[i].left = x; |
9541
a5e34830f00d
(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"
belugas
parents:
9539
diff
changeset
|
791 |
x += (spacing != 0) ? button_width : (w->width - x) / (widgetcount - i); |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
792 |
w->widget[i].right = x - 1; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
793 |
} |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
794 |
|
9538
0507f463f71f
(svn r13542) -Codechange: Less a few more magic numbers and a code a bit more adaptable, still
belugas
parents:
9537
diff
changeset
|
795 |
w->widget[i].type = WWT_EMPTY; // i now points to the last item |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
796 |
_toolbar_mode = TB_NORMAL; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
797 |
} |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
798 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
799 |
/* --- Split the toolbar */ |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
800 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
801 |
static void SplitToolbar(Window *w) |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
802 |
{ |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
803 |
static const byte arrange14[] = { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
804 |
0, 1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
805 |
2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 24, 25, 26, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
806 |
}; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
807 |
static const byte arrange15[] = { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
808 |
0, 1, 4, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
809 |
0, 2, 4, 3, 5, 6, 7, 8, 9, 10, 12, 24, 25, 26, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
810 |
}; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
811 |
static const byte arrange16[] = { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
812 |
0, 1, 2, 4, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
813 |
0, 1, 3, 5, 6, 7, 8, 9, 10, 12, 24, 25, 26, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
814 |
}; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
815 |
static const byte arrange17[] = { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
816 |
0, 1, 2, 4, 6, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
817 |
0, 1, 3, 4, 6, 5, 7, 8, 9, 10, 12, 24, 25, 26, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
818 |
}; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
819 |
static const byte arrange18[] = { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
820 |
0, 1, 2, 4, 5, 6, 7, 8, 9, 12, 19, 20, 21, 22, 23, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
821 |
0, 1, 3, 4, 5, 6, 7, 10, 13, 14, 15, 16, 24, 25, 26, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
822 |
}; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
823 |
static const byte arrange19[] = { |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
824 |
0, 1, 2, 4, 5, 6, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
825 |
0, 1, 3, 4, 7, 8, 9, 10, 12, 25, 19, 20, 21, 22, 23, 26, 17, 18, 27, |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
826 |
}; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
827 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
828 |
static const byte *arrangements[] = { arrange14, arrange15, arrange16, arrange17, arrange18, arrange19 }; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
829 |
|
9602
612fedc5267f
(svn r13644) -Fix(r13643): compare an apple with an apple. MSVC seems to not care, but some other compilers do.
belugas
parents:
9601
diff
changeset
|
830 |
uint max_icons = max(TBP_TOOLBAR_MINBUTTON, (ToolBarProperties)((w->width + TBP_BUTTONWIDTH / 2) / TBP_BUTTONWIDTH)); |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
831 |
|
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
832 |
assert(max_icons >= TBP_TOOLBAR_MINBUTTON && max_icons <= TBP_NORMAL_MAXBUTTON); |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
833 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
834 |
/* first hide all icons */ |
9541
a5e34830f00d
(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"
belugas
parents:
9539
diff
changeset
|
835 |
for (uint i = 0; i < w->widget_count - 1; i++) { |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
836 |
w->widget[i].type = WWT_EMPTY; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
837 |
} |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
838 |
|
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
839 |
/* now activate them all on their proper positions */ |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
840 |
for (uint i = 0, x = 0, n = max_icons - TBP_TOOLBAR_MINBUTTON; i < max_icons; i++) { |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
841 |
uint icon = arrangements[n][i + ((_toolbar_mode == TB_LOWER) ? max_icons : 0)]; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
842 |
w->widget[icon].type = WWT_IMGBTN; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
843 |
w->widget[icon].left = x; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
844 |
x += (w->width - x) / (max_icons - i); |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
845 |
w->widget[icon].right = x - 1; |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
846 |
} |
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
847 |
} |
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
|
848 |
|
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
|
849 |
/* --- 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
|
850 |
|
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
|
851 |
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
|
852 |
|
e513a23c2797
(svn 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 |
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
|
854 |
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
|
855 |
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
|
856 |
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
|
857 |
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
|
858 |
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
|
859 |
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
|
860 |
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
|
861 |
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
|
862 |
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
|
863 |
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
|
864 |
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
|
865 |
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
|
866 |
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
|
867 |
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
|
868 |
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
|
869 |
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
|
870 |
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
|
871 |
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
|
872 |
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
|
873 |
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
|
874 |
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
|
875 |
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
|
876 |
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
|
877 |
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
|
878 |
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
|
879 |
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
|
880 |
ToolbarHelpClick, |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
881 |
ToolbarSwitchClick, |
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
|
882 |
}; |
e513a23c2797
(svn 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 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
884 |
struct MainToolbarWindow : Window { |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
885 |
MainToolbarWindow(const WindowDesc *desc) : Window(desc) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
886 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
887 |
this->SetWidgetDisabledState(TBN_PAUSE, _networking && !_network_server); // if not server, disable pause button |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
888 |
this->SetWidgetDisabledState(TBN_FASTFORWARD, _networking); // if networking, disable fast-forward button |
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
|
889 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
890 |
CLRBITS(this->flags4, WF_WHITE_BORDER_MASK); |
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
|
891 |
|
9310
d2f150a6e2f0
(svn r13178) -Fix (r13173): the main toolbar didn't respect patch settings, it was always positioned on the right side
smatz
parents:
9305
diff
changeset
|
892 |
this->FindWindowPlacementAndResize(desc); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
893 |
PositionMainToolbar(this); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
894 |
DoZoomInOutWindow(ZOOM_NONE, this); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
895 |
} |
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
|
896 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
897 |
virtual void OnPaint() |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
898 |
{ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
899 |
/* Draw brown-red toolbar bg. */ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
900 |
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2); |
9607
5a5728fb702a
(svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch
parents:
9604
diff
changeset
|
901 |
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB4, FILLRECT_CHECKER); |
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
|
902 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
903 |
/* If spectator, disable all construction buttons |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
904 |
* ie : Build road, rail, ships, airports and landscaping |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
905 |
* Since enabled state is the default, just disable when needed */ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
906 |
this->SetWidgetsDisabledState(_current_player == PLAYER_SPECTATOR, TBN_RAILS, TBN_ROADS, TBN_WATER, TBN_AIR, TBN_LANDSCAPE, WIDGET_LIST_END); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
907 |
/* disable company list drop downs, if there are no companies */ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
908 |
this->SetWidgetsDisabledState(ActivePlayerCount() == TBN_PAUSE, TBN_STATIONS, TBN_FINANCES, TBN_TRAINS, TBN_ROADVEHS, TBN_SHIPS, TBN_AIRCRAFTS, WIDGET_LIST_END); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
909 |
|
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
910 |
this->SetWidgetDisabledState(TBN_RAILS, !CanBuildVehicleInfrastructure(VEH_TRAIN)); |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
911 |
this->SetWidgetDisabledState(TBN_AIR, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
912 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
913 |
this->DrawWidgets(); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
914 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
915 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
916 |
virtual void OnClick(Point pt, int widget) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
917 |
{ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
918 |
if (_game_mode != GM_MENU && !this->IsWidgetDisabled(widget)) _toolbar_button_procs[widget](this); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
919 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
920 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
921 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
922 |
{ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
923 |
switch (keycode) { |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
924 |
case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(this); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
925 |
case WKC_F2: ShowGameOptions(); break; |
9610
a4260e8b9191
(svn r13663) -Codechange: Use a default parameter, hoping to reduce the different signatures of functions in menus
belugas
parents:
9607
diff
changeset
|
926 |
case WKC_F3: MenuClickSaveLoad(); break; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
927 |
case WKC_F4: ShowSmallMap(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
928 |
case WKC_F5: ShowTownDirectory(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
929 |
case WKC_F6: ShowSubsidiesList(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
930 |
case WKC_F7: ShowPlayerStations(_local_player); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
931 |
case WKC_F8: ShowPlayerFinances(_local_player); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
932 |
case WKC_F9: ShowPlayerCompany(_local_player); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
933 |
case WKC_F10: ShowOperatingProfitGraph(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
934 |
case WKC_F11: ShowCompanyLeagueTable(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
935 |
case WKC_F12: ShowBuildIndustryWindow(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
936 |
case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, VEH_TRAIN); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
937 |
case WKC_SHIFT | WKC_F2: ShowVehicleListWindow(_local_player, VEH_ROAD); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
938 |
case WKC_SHIFT | WKC_F3: ShowVehicleListWindow(_local_player, VEH_SHIP); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
939 |
case WKC_SHIFT | WKC_F4: ShowVehicleListWindow(_local_player, VEH_AIRCRAFT); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
940 |
case WKC_NUM_PLUS: // Fall through |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
941 |
case WKC_EQUALS: // Fall through |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
942 |
case WKC_SHIFT | WKC_EQUALS: // Fall through |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
943 |
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(this); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
944 |
case WKC_NUM_MINUS: // Fall through |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
945 |
case WKC_MINUS: // Fall through |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
946 |
case WKC_SHIFT | WKC_MINUS: // Fall through |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
947 |
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(this); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
948 |
case WKC_SHIFT | WKC_F7: if (CanBuildVehicleInfrastructure(VEH_TRAIN)) ShowBuildRailToolbar(_last_built_railtype, -1); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
949 |
case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(_last_built_roadtype); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
950 |
case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
951 |
case WKC_SHIFT | WKC_F10: if (CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) ShowBuildAirToolbar(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
952 |
case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
953 |
case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
954 |
case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
955 |
case WKC_CTRL | 'G': MenuClickWorldScreenshot(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
956 |
case WKC_CTRL | WKC_ALT | 'C': if (!_networking) ShowCheatWindow(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
957 |
case 'A': if (CanBuildVehicleInfrastructure(VEH_TRAIN)) ShowBuildRailToolbar(_last_built_railtype, 4); break; // Invoke Autorail |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
958 |
case 'L': ShowTerraformToolbar(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
959 |
case 'M': ShowSmallMap(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
960 |
case 'V': ShowExtraViewPortWindow(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
961 |
default: return ES_NOT_HANDLED; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
962 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
963 |
return ES_HANDLED; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
964 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
965 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
966 |
virtual void OnPlaceObject(Point pt, TileIndex tile) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
967 |
{ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
968 |
_place_proc(tile); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
969 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
970 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
971 |
virtual void OnTick() |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
972 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
973 |
if (this->IsWidgetLowered(TBN_PAUSE) != !!_pause_game) { |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
974 |
this->ToggleWidgetLoweredState(TBN_PAUSE); |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
975 |
this->InvalidateWidget(TBN_PAUSE); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
976 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
977 |
|
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
978 |
if (this->IsWidgetLowered(TBN_FASTFORWARD) != !!_fast_forward) { |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
979 |
this->ToggleWidgetLoweredState(TBN_FASTFORWARD); |
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
980 |
this->InvalidateWidget(TBN_FASTFORWARD); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
981 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
982 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
983 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
984 |
virtual void OnResize(Point new_size, Point delta) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
985 |
{ |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
986 |
if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) { |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
987 |
SplitToolbar(this); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
988 |
} else { |
9425
fe15794c1448
(svn r13339) -Feature: splitting of the main toolbar when the resolution becomes very low so the buttons are still visible and useable. Patch by Dominik.
rubidium
parents:
9354
diff
changeset
|
989 |
ResizeToolbar(this); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
990 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
991 |
} |
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
|
992 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
993 |
virtual void OnTimeout() |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
994 |
{ |
9541
a5e34830f00d
(svn r13550) -Fix(r13540, r13542): widget_count did not had the same value as 27. So, it has to be lowered by one, so it can be used as a widget "pointer"
belugas
parents:
9539
diff
changeset
|
995 |
for (uint i = TBN_SETTINGS; i < this->widget_count - 1; i++) { |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
996 |
if (this->IsWidgetLowered(i)) { |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
997 |
this->RaiseWidget(i); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
998 |
this->InvalidateWidget(i); |
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
|
999 |
} |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1000 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1001 |
} |
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
|
1002 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1003 |
virtual void OnInvalidateData(int data) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1004 |
{ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
1005 |
if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBN_ZOOMIN, TBN_ZOOMOUT); |
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
|
1006 |
} |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1007 |
}; |
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
|
1008 |
|
e513a23c2797
(svn 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 |
static const Widget _toolb_normal_widgets[] = { |
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1010 |
{ WWT_IMGBTN, RESIZE_LEFT, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_PAUSE, STR_0171_PAUSE_GAME}, // TBN_PAUSE |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1011 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, // TBN_FASTFORWARD |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1012 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SETTINGS, STR_0187_OPTIONS}, // TBN_SETTINGS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1013 |
{ WWT_IMGBTN_2, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SAVE, STR_0172_SAVE_GAME_ABANDON_GAME}, // TBN_SAVEGAME |
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
|
1014 |
|
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1015 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SMALLMAP, STR_0174_DISPLAY_MAP}, // TBN_SMALLMAP |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1016 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_TOWN, STR_0176_DISPLAY_TOWN_DIRECTORY}, // TBN_TOWNDIRECTORY |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1017 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SUBSIDIES, STR_02DC_DISPLAY_SUBSIDIES}, // TBN_SUBSIDIES |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1018 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_COMPANY_LIST, STR_0173_DISPLAY_LIST_OF_COMPANY}, // TBN_STATIONS |
9600
fd5b6cdbe686
(svn r13642) -Documentation: Add the enum values to the widget arrays, in concordance with code style
belugas
parents:
9599
diff
changeset
|
1019 |
|
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1020 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_COMPANY_FINANCE, STR_0177_DISPLAY_COMPANY_FINANCES}, // TBN_FINANCES |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1021 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_COMPANY_GENERAL, STR_0178_DISPLAY_COMPANY_GENERAL}, // TBN_PLAYERS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1022 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_GRAPHS, STR_0179_DISPLAY_GRAPHS}, // TBN_GRAPHICS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1023 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_COMPANY_LEAGUE, STR_017A_DISPLAY_COMPANY_LEAGUE}, // TBN_LEAGUE |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1024 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_INDUSTRY, STR_0312_FUND_CONSTRUCTION_OF_NEW}, // TBN_INDUSTRIES |
9600
fd5b6cdbe686
(svn r13642) -Documentation: Add the enum values to the widget arrays, in concordance with code style
belugas
parents:
9599
diff
changeset
|
1025 |
|
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1026 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_TRAINLIST, STR_017B_DISPLAY_LIST_OF_COMPANY}, // TBN_TRAINS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1027 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_TRUCKLIST, STR_017C_DISPLAY_LIST_OF_COMPANY}, // TBN_ROADVEHS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1028 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SHIPLIST, STR_017D_DISPLAY_LIST_OF_COMPANY}, // TBN_SHIPS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1029 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_AIRPLANESLIST, STR_017E_DISPLAY_LIST_OF_COMPANY}, // TBN_AIRCRAFTS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1030 |
|
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1031 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, // TBN_ZOOMIN |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1032 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, // TBN_ZOOMOUT |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1033 |
|
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1034 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDRAIL, STR_0181_BUILD_RAILROAD_TRACK}, // TBN_RAILS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1035 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDROAD, STR_0182_BUILD_ROADS}, // TBN_ROADS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1036 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDWATER, STR_0183_BUILD_SHIP_DOCKS}, // TBN_WATER |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1037 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDAIR, STR_0184_BUILD_AIRPORTS}, // TBN_AIR |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1038 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, // TBN_LANDSCAPE tree icon is SPR_IMG_PLANTTREES |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1039 |
|
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1040 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_MUSIC, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, // TBN_MUSICSOUND |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1041 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_MESSAGES, STR_0203_SHOW_LAST_MESSAGE_NEWS}, // TBN_NEWSREPORT |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1042 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_QUERY, STR_0186_LAND_BLOCK_INFORMATION}, // TBN_HELP |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1043 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_SWITCH_TOOLBAR, STR_EMPTY}, // TBN_SWITCHBAR |
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
|
1044 |
{ 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
|
1045 |
}; |
e513a23c2797
(svn 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 |
|
e513a23c2797
(svn 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 |
static const WindowDesc _toolb_normal_desc = { |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1048 |
0, 0, 0, TBP_BUTTONHEIGHT, 640, TBP_BUTTONHEIGHT, |
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
|
1049 |
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
|
1050 |
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
|
1051 |
_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
|
1052 |
}; |
e513a23c2797
(svn 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 |
|
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
|
1055 |
/* --- 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
|
1056 |
|
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
|
1057 |
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
|
1058 |
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
|
1059 |
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
|
1060 |
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
|
1061 |
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
|
1062 |
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
|
1063 |
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
|
1064 |
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
|
1065 |
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
|
1066 |
ToolbarScenMapTownDir, |
9614
16dc70d4f3aa
(svn r13670) -Codechange : Merge some very alike events handlers.
belugas
parents:
9610
diff
changeset
|
1067 |
ToolbarZoomInClick, |
16dc70d4f3aa
(svn r13670) -Codechange : Merge some very alike events handlers.
belugas
parents:
9610
diff
changeset
|
1068 |
ToolbarZoomOutClick, |
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
|
1069 |
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
|
1070 |
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
|
1071 |
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
|
1072 |
ToolbarScenBuildRoad, |
9588
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
1073 |
ToolbarScenBuildDocks, |
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
|
1074 |
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
|
1075 |
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
|
1076 |
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
|
1077 |
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
|
1078 |
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
|
1079 |
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
|
1080 |
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
|
1081 |
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
|
1082 |
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
|
1083 |
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
|
1084 |
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
|
1085 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1086 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1087 |
struct ScenarioEditorToolbarWindow : Window { |
9513
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1088 |
public: |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1089 |
ScenarioEditorToolbarWindow(const WindowDesc *desc) : Window(desc) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1090 |
{ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1091 |
CLRBITS(this->flags4, WF_WHITE_BORDER_MASK); |
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
|
1092 |
|
9311
96b830227d9e
(svn r13179) -Fix (r13173): r13178 applies to the main toolbar in Scenario Editor, too
smatz
parents:
9310
diff
changeset
|
1093 |
this->FindWindowPlacementAndResize(desc); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1094 |
PositionMainToolbar(this); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1095 |
DoZoomInOutWindow(ZOOM_NONE, this); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1096 |
} |
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
|
1097 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1098 |
virtual void OnPaint() |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1099 |
{ |
9513
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1100 |
this->SetWidgetDisabledState(TBSE_DATEBACKWARD, _settings_newgame.game_creation.starting_year <= MIN_YEAR); |
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1101 |
this->SetWidgetDisabledState(TBSE_DATEFORWARD, _settings_newgame.game_creation.starting_year >= MAX_YEAR); |
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
|
1102 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1103 |
/* Draw brown-red toolbar bg. */ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1104 |
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2); |
9607
5a5728fb702a
(svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch
parents:
9604
diff
changeset
|
1105 |
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB4, FILLRECT_CHECKER); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1106 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1107 |
this->DrawWidgets(); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1108 |
|
9354
845e07db4549
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
9336
diff
changeset
|
1109 |
SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); |
9513
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1110 |
DrawStringCenteredTruncated(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1111 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1112 |
/* We hide this panel when the toolbar space gets too small */ |
9513
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1113 |
const Widget *panel = &this->widget[TBSE_SPACERPANEL]; |
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1114 |
if (panel->left != panel->right) { |
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1115 |
DrawStringCenteredTruncated(panel->left + 1, panel->right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING); |
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1116 |
DrawStringCenteredTruncated(panel->left + 1, panel->right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1117 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1118 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1119 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1120 |
virtual void OnClick(Point pt, int widget) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1121 |
{ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1122 |
if (_game_mode == GM_MENU) return; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1123 |
_scen_toolbar_button_procs[widget](this); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1124 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1125 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1126 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1127 |
{ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1128 |
switch (keycode) { |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1129 |
case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(this); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1130 |
case WKC_F2: ShowGameOptions(); break; |
9610
a4260e8b9191
(svn r13663) -Codechange: Use a default parameter, hoping to reduce the different signatures of functions in menus
belugas
parents:
9607
diff
changeset
|
1131 |
case WKC_F3: MenuClickSaveLoad(); break; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1132 |
case WKC_F4: ToolbarScenGenLand(this); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1133 |
case WKC_F5: ToolbarScenGenTown(this); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1134 |
case WKC_F6: ToolbarScenGenIndustry(this); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1135 |
case WKC_F7: ToolbarScenBuildRoad(this); break; |
9588
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
1136 |
case WKC_F8: ToolbarScenBuildDocks(this); break; |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
1137 |
case WKC_F9: ToolbarScenPlantTrees(this); break; |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
1138 |
case WKC_F10: ToolbarScenPlaceSign(this); break; |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
1139 |
case WKC_F11: ShowMusicWindow(); break; |
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
1140 |
case WKC_F12: PlaceLandBlockInfo(); break; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1141 |
case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1142 |
case WKC_CTRL | 'G': MenuClickWorldScreenshot(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1143 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1144 |
/* those following are all fall through */ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1145 |
case WKC_NUM_PLUS: |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1146 |
case WKC_EQUALS: |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1147 |
case WKC_SHIFT | WKC_EQUALS: |
9614
16dc70d4f3aa
(svn r13670) -Codechange : Merge some very alike events handlers.
belugas
parents:
9610
diff
changeset
|
1148 |
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(this); break; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1149 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1150 |
/* those following are all fall through */ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1151 |
case WKC_NUM_MINUS: |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1152 |
case WKC_MINUS: |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1153 |
case WKC_SHIFT | WKC_MINUS: |
9614
16dc70d4f3aa
(svn r13670) -Codechange : Merge some very alike events handlers.
belugas
parents:
9610
diff
changeset
|
1154 |
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(this); break; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1155 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1156 |
case 'L': ShowEditorTerraformToolbar(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1157 |
case 'M': ShowSmallMap(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1158 |
case 'V': ShowExtraViewPortWindow(); break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1159 |
default: return ES_NOT_HANDLED; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1160 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1161 |
return ES_HANDLED; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1162 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1163 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1164 |
virtual void OnPlaceObject(Point pt, TileIndex tile) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1165 |
{ |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1166 |
_place_proc(tile); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1167 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1168 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1169 |
virtual void OnResize(Point new_size, Point delta) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1170 |
{ |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1171 |
/* There are 16 buttons plus some spacings if the space allows it. |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1172 |
* Furthermore there are two panels of which one is non - essential |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1173 |
* and that one can be removed if the space is too small. */ |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1174 |
uint buttons_width; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1175 |
uint spacing; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1176 |
|
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1177 |
static const int normal_min_width = (TBP_SCENARIO_MAXBUTTON * TBP_BUTTONWIDTH) + (2 * TBP_DATEPANELWIDTH); |
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1178 |
static const int one_less_panel_min_width = (TBP_SCENARIO_MAXBUTTON * TBP_BUTTONWIDTH) + TBP_DATEPANELWIDTH; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1179 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1180 |
if (this->width >= one_less_panel_min_width) { |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1181 |
buttons_width = TBP_SCENARIO_MAXBUTTON * TBP_BUTTONWIDTH; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1182 |
spacing = this->width - ((this->width >= normal_min_width) ? normal_min_width : one_less_panel_min_width); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1183 |
} else { |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1184 |
buttons_width = this->width - TBP_DATEPANELWIDTH; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1185 |
spacing = 0; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1186 |
} |
9588
620c97d8cee4
(svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13
parents:
9571
diff
changeset
|
1187 |
static const uint extra_spacing_at[] = { 3, 4, 7, 8, 10, 17, 0 }; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1188 |
|
9545
051a6dedd9bd
(svn r13560) -Fix(r13550): This section widget_count did not required to be lowered. So small revert
belugas
parents:
9544
diff
changeset
|
1189 |
for (uint i = 0, x = 0, j = 0, b = 0; i < this->widget_count; i++) { |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1190 |
switch (i) { |
9546
ef63aaf13119
(svn r13561) -Codechange: two more enumifications of widgets
belugas
parents:
9545
diff
changeset
|
1191 |
case TBSE_SPACERPANEL: |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1192 |
this->widget[i].left = x; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1193 |
if (this->width < normal_min_width) { |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1194 |
this->widget[i].right = x; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1195 |
j++; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1196 |
continue; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1197 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1198 |
|
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1199 |
x += TBP_DATEPANELWIDTH; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1200 |
this->widget[i].right = x - 1; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1201 |
break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1202 |
|
9599 | 1203 |
case TBSE_DATEPANEL: { |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1204 |
int offset = x - this->widget[i].left; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1205 |
this->widget[i + 1].left += offset; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1206 |
this->widget[i + 1].right += offset; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1207 |
this->widget[i + 2].left += offset; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1208 |
this->widget[i + 2].right += offset; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1209 |
this->widget[i].left = x; |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1210 |
x += TBP_DATEPANELWIDTH; |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1211 |
this->widget[i].right = x - 1; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1212 |
i += 2; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1213 |
} break; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1214 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1215 |
default: |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1216 |
if (this->widget[i].bottom == 0) continue; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1217 |
|
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1218 |
this->widget[i].left = x; |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1219 |
x += buttons_width / (TBP_SCENARIO_MAXBUTTON - b); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1220 |
this->widget[i].right = x - 1; |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1221 |
buttons_width -= buttons_width / (TBP_SCENARIO_MAXBUTTON - b); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1222 |
b++; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1223 |
break; |
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
|
1224 |
} |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1225 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1226 |
if (extra_spacing_at[j] == i) { |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1227 |
j++; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1228 |
uint add = spacing / (lengthof(extra_spacing_at) - j); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1229 |
spacing -= add; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1230 |
x += add; |
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
|
1231 |
} |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1232 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1233 |
} |
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
|
1234 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1235 |
virtual void OnTick() |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1236 |
{ |
9513
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1237 |
if (this->IsWidgetLowered(TBSE_PAUSE) != !!_pause_game) { |
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1238 |
this->ToggleWidgetLoweredState(TBSE_PAUSE); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1239 |
this->SetDirty(); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1240 |
} |
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
|
1241 |
|
9513
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1242 |
if (this->IsWidgetLowered(TBSE_FASTFORWARD) != !!_fast_forward) { |
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1243 |
this->ToggleWidgetLoweredState(TBSE_FASTFORWARD); |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1244 |
this->SetDirty(); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1245 |
} |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1246 |
} |
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
|
1247 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1248 |
virtual void OnInvalidateData(int data) |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1249 |
{ |
9513
17d3f5505bf5
(svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas
parents:
9512
diff
changeset
|
1250 |
if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBSE_ZOOMIN, TBSE_ZOOMOUT); |
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
|
1251 |
} |
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1252 |
}; |
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
|
1253 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1254 |
static const Widget _toolb_scen_widgets[] = { |
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1255 |
{ WWT_IMGBTN, RESIZE_LEFT, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_PAUSE, STR_0171_PAUSE_GAME}, // TBSE_PAUSE |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1256 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, // TBSE_FASTFORWARD |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1257 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SETTINGS, STR_0187_OPTIONS}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1258 |
{WWT_IMGBTN_2, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SAVE, STR_0297_SAVE_SCENARIO_LOAD_SCENARIO}, // TBSE_SAVESCENARIO |
9600
fd5b6cdbe686
(svn r13642) -Documentation: Add the enum values to the widget arrays, in concordance with code style
belugas
parents:
9599
diff
changeset
|
1259 |
|
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1260 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, 0x0, STR_NULL}, // TBSE_SPACERPANEL |
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
|
1261 |
|
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1262 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 129, 0, 21, 0x0, STR_NULL}, // TBSE_DATEPANEL |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1263 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 3, 14, 5, 16, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE}, // TBSE_DATEBACKWARD |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1264 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 113, 125, 5, 16, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE}, // TBSE_DATEFORWARD |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1265 |
|
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1266 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SMALLMAP, STR_0175_DISPLAY_MAP_TOWN_DIRECTORY}, // TBSE_SMALLMAP |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1267 |
|
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1268 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, // TBSE_ZOOMIN |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1269 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, // TBSE_ZOOMOUT |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1270 |
|
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1271 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_LANDSCAPING, STR_022E_LANDSCAPE_GENERATION}, // TBSE_LANDGENERATE |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1272 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_TOWN, STR_022F_TOWN_GENERATION}, // TBSE_TOWNGENERATE |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1273 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_INDUSTRY, STR_0230_INDUSTRY_GENERATION}, // TBSE_INDUSTRYGENERATE |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1274 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDROAD, STR_0231_ROAD_CONSTRUCTION}, // TBSE_BUILDROAD |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1275 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDWATER, STR_0183_BUILD_SHIP_DOCKS}, // TBSE_BUILDDOCKS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1276 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_PLANTTREES, STR_0288_PLANT_TREES}, // TBSE_PLANTTREES |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1277 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SIGN, STR_0289_PLACE_SIGN}, // TBSE_PLACESIGNS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1278 |
|
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1279 |
{ WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1280 |
{ WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1281 |
{ WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1282 |
{ WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1283 |
{ WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1284 |
{ WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1285 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_MUSIC, STR_01D4_SHOW_SOUND_MUSIC_WINDOW}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1286 |
{ WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9659
diff
changeset
|
1287 |
{ WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_QUERY, STR_0186_LAND_BLOCK_INFORMATION}, |
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
|
1288 |
{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
|
1289 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1290 |
|
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1291 |
static const WindowDesc _toolb_scen_desc = { |
9601
8feccda0f30a
(svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas
parents:
9600
diff
changeset
|
1292 |
0, 0, 130, TBP_BUTTONHEIGHT, 640, TBP_BUTTONHEIGHT, |
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
|
1293 |
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
|
1294 |
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
|
1295 |
_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
|
1296 |
}; |
e513a23c2797
(svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium
parents:
diff
changeset
|
1297 |
|
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
|
1298 |
/* --- 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
|
1299 |
|
678648173fcf
(svn r12767) -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 |
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
|
1301 |
|
678648173fcf
(svn r12767) -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 |
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
|
1303 |
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
|
1304 |
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
|
1305 |
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
|
1306 |
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
|
1307 |
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
|
1308 |
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
|
1309 |
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
|
1310 |
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
|
1311 |
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
|
1312 |
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
|
1313 |
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
|
1314 |
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
|
1315 |
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
|
1316 |
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
|
1317 |
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
|
1318 |
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
|
1319 |
MenuClickShowAir, /* 16 */ |
9571
25cd08543e6e
(svn r13597) -Codechange: Enumification of the Map menu items.
belugas
parents:
9566
diff
changeset
|
1320 |
MenuClickMap, /* 17 */ |
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
|
1321 |
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
|
1322 |
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
|
1323 |
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
|
1324 |
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
|
1325 |
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
|
1326 |
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
|
1327 |
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
|
1328 |
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
|
1329 |
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
|
1330 |
}; |
678648173fcf
(svn r12767) -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 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1332 |
struct ToolbarMenuWindow : Window { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1333 |
int item_count; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1334 |
int sel_index; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1335 |
int main_button; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1336 |
int action_id; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1337 |
int checked_items; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1338 |
int disabled_items; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1339 |
StringID base_string; |
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
|
1340 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1341 |
ToolbarMenuWindow(int x, int y, int width, int height, const Widget *widgets, int item_count, |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1342 |
int sel_index, int parent_button, StringID base_string, int checked_items, |
9324
1320fbd5b84f
(svn r13208) -Fix (r13173): it was possible to open invalid submenu from dropdowns
smatz
parents:
9317
diff
changeset
|
1343 |
int disabled_items) : |
9301
3b20dfb6c4e8
(svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium
parents:
9273
diff
changeset
|
1344 |
Window(x, y, width, height, WC_TOOLBAR_MENU, widgets), |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1345 |
item_count(item_count), sel_index(sel_index), main_button(GB(parent_button, 0, 8)), |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1346 |
action_id((GB(parent_button, 8, 8) != 0) ? GB(parent_button, 8, 8) : parent_button), |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1347 |
checked_items(checked_items), disabled_items(disabled_items), base_string(base_string) |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1348 |
{ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1349 |
this->widget[0].bottom = item_count * 10 + 1; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1350 |
this->widget[0].right = this->width - 1; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1351 |
this->flags4 &= ~WF_WHITE_BORDER_MASK; |
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 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1353 |
this->FindWindowPlacementAndResize(width, height); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1354 |
} |
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
|
1355 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1356 |
~ToolbarMenuWindow() |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1357 |
{ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1358 |
Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1359 |
w->RaiseWidget(this->main_button); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1360 |
w->SetDirty(); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1361 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1362 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1363 |
virtual void OnPaint() |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1364 |
{ |
9273
35e0224ea8f1
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
9242
diff
changeset
|
1365 |
this->DrawWidgets(); |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1366 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1367 |
for (int i = 0, x = 1, y = 1; i != this->item_count; i++, y += 10) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1368 |
TextColour color = HasBit(this->disabled_items, i) ? TC_GREY : (this->sel_index == i) ? TC_WHITE : TC_BLACK; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1369 |
if (this->sel_index == i) GfxFillRect(x, y, x + this->width - 3, y + 9, 0); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1370 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1371 |
if (HasBit(this->checked_items, i)) DrawString(x + 2, y, STR_CHECKMARK, color); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1372 |
DrawString(x + 2, y, this->base_string + i, color); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1373 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1374 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1375 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1376 |
virtual void OnMouseLoop() |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1377 |
{ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1378 |
int index = GetMenuItemIndex(this, this->item_count, this->disabled_items); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1379 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1380 |
if (_left_button_down) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1381 |
if (index == -1 || index == this->sel_index) return; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1382 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1383 |
this->sel_index = index; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1384 |
this->SetDirty(); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1385 |
} else { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1386 |
if (index < 0) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1387 |
Window *w = FindWindowById(WC_MAIN_TOOLBAR,0); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1388 |
if (GetWidgetFromPos(w, _cursor.pos.x - w->left, _cursor.pos.y - w->top) == this->main_button) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1389 |
index = this->sel_index; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1390 |
} |
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
|
1391 |
} |
678648173fcf
(svn r12767) -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 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1393 |
int action_id = this->action_id; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1394 |
delete this; |
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
|
1395 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1396 |
if (index >= 0) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1397 |
assert((uint)index <= lengthof(_menu_clicked_procs)); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1398 |
_menu_clicked_procs[action_id](index); |
9162
13d4188eab56
(svn r13025) -Codechange: remove the need for two WindowEvents.
rubidium
parents:
9161
diff
changeset
|
1399 |
} |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1400 |
} |
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
|
1401 |
} |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1402 |
}; |
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
|
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 |
/* 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
|
1405 |
* 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
|
1406 |
static const Widget _menu_widgets[] = { |
9827
338aac16d11b
(svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents:
9778
diff
changeset
|
1407 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, |
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
|
1408 |
{ 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
|
1409 |
}; |
678648173fcf
(svn r12767) -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 |
|
678648173fcf
(svn r12767) -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 |
|
678648173fcf
(svn r12767) -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 |
* 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
|
1414 |
* 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
|
1415 |
* @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
|
1416 |
* @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
|
1417 |
* @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
|
1418 |
*/ |
678648173fcf
(svn r12767) -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 |
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
|
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 |
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
|
1422 |
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
|
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 |
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
|
1425 |
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
|
1426 |
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
|
1427 |
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
|
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 |
|
678648173fcf
(svn r12767) -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 |
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
|
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 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1433 |
/** |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1434 |
* 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
|
1435 |
* 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
|
1436 |
* 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
|
1437 |
* 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
|
1438 |
* 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
|
1439 |
* 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
|
1440 |
* restricted to 8 items max if any bits of disabled_mask are active. |
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1441 |
* @param parent Pointer to a window this dropdown menu belongs to. Has no effect |
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
|
1442 |
* 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
|
1443 |
* @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
|
1444 |
* 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
|
1445 |
* 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
|
1446 |
* 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
|
1447 |
* 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
|
1448 |
* 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
|
1449 |
* 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
|
1450 |
* 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
|
1451 |
* @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
|
1452 |
* 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
|
1453 |
* @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
|
1454 |
* @param disabled_mask Bitmask of disabled strings in the list |
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1455 |
* @param sel_index The selected toolbar item |
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1456 |
* @param check_items The items to have a checked mark in front of them. |
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1457 |
* @return Return a pointer to the newly created dropdown window |
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1458 |
*/ |
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1459 |
static void PopupMainToolbMenu(Window *parent, uint16 parent_button, StringID base_string, byte item_count, byte disabled_mask, int sel_index, int checked_items) |
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
|
1460 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1461 |
assert(disabled_mask == 0 || item_count <= 8); |
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1462 |
parent->LowerWidget(parent_button); |
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1463 |
parent->InvalidateWidget(parent_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
|
1464 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1465 |
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
|
1466 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1467 |
/* 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
|
1468 |
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
|
1469 |
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
|
1470 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1471 |
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
|
1472 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1473 |
new ToolbarMenuWindow(pos.x, pos.y, width, height, _menu_widgets, item_count, sel_index, parent_button, base_string, checked_items, disabled_mask); |
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
|
1474 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1475 |
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
|
1476 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1477 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1478 |
/* --- 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
|
1479 |
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
|
1480 |
{ |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1481 |
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
|
1482 |
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
|
1483 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1484 |
FOR_ALL_PLAYERS(p) { |
9659
187142ff9b6c
(svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents:
9616
diff
changeset
|
1485 |
if (--index < 0) return p->index; |
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
|
1486 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1487 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1488 |
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
|
1489 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1490 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1491 |
struct ToolbarPlayerMenuWindow : Window { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1492 |
int item_count; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1493 |
int sel_index; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1494 |
int main_button; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1495 |
int action_id; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1496 |
int gray_items; |
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
|
1497 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1498 |
ToolbarPlayerMenuWindow(int x, int y, int width, int height, const Widget *widgets, int main_button, int gray) : |
9301
3b20dfb6c4e8
(svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium
parents:
9273
diff
changeset
|
1499 |
Window(x, y, width, height, WC_TOOLBAR_MENU, widgets), |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1500 |
item_count(0), main_button(main_button), action_id(main_button), gray_items(gray) |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1501 |
{ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1502 |
this->flags4 &= ~WF_WHITE_BORDER_MASK; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1503 |
this->sel_index = (_local_player != PLAYER_SPECTATOR) ? _local_player : GetPlayerIndexFromMenu(0); |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
1504 |
if (_networking && main_button == TBN_PLAYERS) { |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1505 |
if (_local_player != PLAYER_SPECTATOR) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1506 |
this->sel_index++; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1507 |
} else { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1508 |
/* Select client list by default for spectators */ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1509 |
this->sel_index = 0; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1510 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1511 |
} |
9333
2da01b3b71d8
(svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138
parents:
9324
diff
changeset
|
1512 |
|
2da01b3b71d8
(svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138
parents:
9324
diff
changeset
|
1513 |
this->FindWindowPlacementAndResize(width, height); |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1514 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1515 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1516 |
~ToolbarPlayerMenuWindow() |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1517 |
{ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1518 |
Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1519 |
w->RaiseWidget(this->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
|
1520 |
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
|
1521 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1522 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1523 |
void UpdatePlayerMenuHeight() |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1524 |
{ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1525 |
byte num = ActivePlayerCount(); |
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
|
1526 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1527 |
/* Increase one to fit in PlayerList in the menu when in network */ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
1528 |
if (_networking && this->main_button == TBN_PLAYERS) num++; |
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
|
1529 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1530 |
if (this->item_count != num) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1531 |
this->item_count = num; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1532 |
this->SetDirty(); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1533 |
num = num * 10 + 2; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1534 |
this->height = num; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1535 |
this->widget[0].bottom = this->widget[0].top + num - 1; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1536 |
this->top = GetToolbarDropdownPos(0, this->width, this->height).y; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1537 |
this->SetDirty(); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1538 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1539 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1540 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1541 |
virtual void OnPaint() |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1542 |
{ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1543 |
this->UpdatePlayerMenuHeight(); |
9273
35e0224ea8f1
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
9242
diff
changeset
|
1544 |
this->DrawWidgets(); |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1545 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1546 |
int x = 1; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1547 |
int y = 1; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1548 |
int sel = this->sel_index; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1549 |
int gray = this->gray_items; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1550 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1551 |
/* 9 = playerlist */ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
1552 |
if (_networking && this->main_button == TBN_PLAYERS) { |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1553 |
if (sel == 0) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1554 |
GfxFillRect(x, y, x + 238, y + 9, 0); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1555 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1556 |
DrawString(x + 19, y, STR_NETWORK_CLIENT_LIST, TC_FROMSTRING); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1557 |
y += 10; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1558 |
sel--; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1559 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1560 |
|
9659
187142ff9b6c
(svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents:
9616
diff
changeset
|
1561 |
for (PlayerID p = PLAYER_FIRST; p < MAX_PLAYERS; p++) { |
187142ff9b6c
(svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents:
9616
diff
changeset
|
1562 |
if (IsValidPlayerID(p)) { |
187142ff9b6c
(svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents:
9616
diff
changeset
|
1563 |
if (p == sel) { |
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
|
1564 |
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
|
1565 |
} |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1566 |
|
9659
187142ff9b6c
(svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents:
9616
diff
changeset
|
1567 |
DrawPlayerIcon(p, x + 2, y + 1); |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1568 |
|
9659
187142ff9b6c
(svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents:
9616
diff
changeset
|
1569 |
SetDParam(0, p); |
187142ff9b6c
(svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents:
9616
diff
changeset
|
1570 |
SetDParam(1, p); |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1571 |
|
9659
187142ff9b6c
(svn r13731) -Codechange: make a pool of the array of players.
rubidium
parents:
9616
diff
changeset
|
1572 |
TextColour color = (p == sel) ? TC_WHITE : TC_BLACK; |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1573 |
if (gray & 1) color = TC_GREY; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1574 |
DrawString(x + 19, y, STR_7021, color); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1575 |
|
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
|
1576 |
y += 10; |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1577 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1578 |
gray >>= 1; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1579 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1580 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1581 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1582 |
virtual void OnMouseLoop() |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1583 |
{ |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1584 |
int index = GetMenuItemIndex(this, this->item_count, 0); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1585 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1586 |
if (_left_button_down) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1587 |
this->UpdatePlayerMenuHeight(); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1588 |
/* We have a new entry at the top of the list of menu 9 when networking |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1589 |
* so keep that in count */ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
1590 |
if (_networking && this->main_button == TBN_PLAYERS) { |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1591 |
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1592 |
} else { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1593 |
index = GetPlayerIndexFromMenu(index); |
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
|
1594 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1595 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1596 |
if (index == -1 || index == this->sel_index) return; |
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
|
1597 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1598 |
this->sel_index = index; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1599 |
this->SetDirty(); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1600 |
} else { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1601 |
int action_id = this->action_id; |
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
|
1602 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1603 |
/* We have a new entry at the top of the list of menu 9 when networking |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1604 |
* so keep that in count */ |
9539
3a1d8eb51a8a
(svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas
parents:
9538
diff
changeset
|
1605 |
if (_networking && this->main_button == TBN_PLAYERS) { |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1606 |
if (index > 0) index = GetPlayerIndexFromMenu(index - 1) + 1; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1607 |
} else { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1608 |
index = GetPlayerIndexFromMenu(index); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1609 |
} |
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
|
1610 |
|
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1611 |
if (index < 0) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1612 |
Window *w = FindWindowById(WC_MAIN_TOOLBAR,0); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1613 |
if (GetWidgetFromPos(w, _cursor.pos.x - w->left, _cursor.pos.y - w->top) == this->main_button) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1614 |
index = this->sel_index; |
9162
13d4188eab56
(svn r13025) -Codechange: remove the need for two WindowEvents.
rubidium
parents:
9161
diff
changeset
|
1615 |
} |
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
|
1616 |
} |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1617 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1618 |
delete this; |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1619 |
|
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1620 |
if (index >= 0) { |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1621 |
assert(index >= 0 && index < 30); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1622 |
_menu_clicked_procs[action_id](index); |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1623 |
} |
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1624 |
} |
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
|
1625 |
} |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1626 |
}; |
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
|
1627 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1628 |
static const Widget _player_menu_widgets[] = { |
9827
338aac16d11b
(svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas
parents:
9778
diff
changeset
|
1629 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 240, 0, 81, 0x0, STR_NULL}, |
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
|
1630 |
{ 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
|
1631 |
}; |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1632 |
|
9564
237aa071feab
(svn r13588) -Documentation: Document the function PopupMainPlayerToolbMenu. Makes it a bit clearer, don't you think?
belugas
parents:
9562
diff
changeset
|
1633 |
/** Shows the list of players appearing under the buttons that are linked to options for |
237aa071feab
(svn r13588) -Documentation: Document the function PopupMainPlayerToolbMenu. Makes it a bit clearer, don't you think?
belugas
parents:
9562
diff
changeset
|
1634 |
* multiple players. |
237aa071feab
(svn r13588) -Documentation: Document the function PopupMainPlayerToolbMenu. Makes it a bit clearer, don't you think?
belugas
parents:
9562
diff
changeset
|
1635 |
* @param parent Window who triggered that action. It's the toolbar, in fact |
237aa071feab
(svn r13588) -Documentation: Document the function PopupMainPlayerToolbMenu. Makes it a bit clearer, don't you think?
belugas
parents:
9562
diff
changeset
|
1636 |
* @param main_button widget which has been used |
237aa071feab
(svn r13588) -Documentation: Document the function PopupMainPlayerToolbMenu. Makes it a bit clearer, don't you think?
belugas
parents:
9562
diff
changeset
|
1637 |
* @param gray bit-mapping of the items that will need to be grayed out once displayed */ |
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1638 |
static void PopupMainPlayerToolbMenu(Window *parent, int main_button, int gray) |
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
|
1639 |
{ |
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1640 |
parent->LowerWidget(main_button); |
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1641 |
parent->InvalidateWidget(main_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
|
1642 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1643 |
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
|
1644 |
Point pos = GetToolbarDropdownPos(main_button, 241, 82); |
9242
787ddde2b852
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents:
9240
diff
changeset
|
1645 |
new ToolbarPlayerMenuWindow(pos.x, pos.y, 241, 82, _player_menu_widgets, main_button, gray); |
9162
13d4188eab56
(svn r13025) -Codechange: remove the need for two WindowEvents.
rubidium
parents:
9161
diff
changeset
|
1646 |
|
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
|
1647 |
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
|
1648 |
} |
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1649 |
|
678648173fcf
(svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium
parents:
8969
diff
changeset
|
1650 |
/* --- 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
|
1651 |
|
9240
1bba02a64d65
(svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium
parents:
9195
diff
changeset
|
1652 |
void AllocateToolbar() |
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
|
1653 |
{ |
9014
2debe412e5b9
(svn r12813) -Fix [FS#1943]: the 'last built railtype' got reset too often.
rubidium
parents:
8977
diff
changeset
|
1654 |
/* 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
|
1655 |
_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
|
1656 |
|
9305
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1657 |
if (_game_mode == GM_EDITOR) { |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1658 |
new ScenarioEditorToolbarWindow(&_toolb_scen_desc);; |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1659 |
} else { |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1660 |
new MainToolbarWindow(&_toolb_normal_desc); |
d6694e58c36b
(svn r13173) -Codechange: make windows of the main toolbars.
rubidium
parents:
9301
diff
changeset
|
1661 |
} |
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
|
1662 |
} |