annotate src/toolbar_gui.cpp @ 12023:3c4566c47b2f draft

(svn r16430) -Fix: crash when a company is deleted while a dropdown with company names is open
author smatz <smatz@openttd.org>
date Tue, 26 May 2009 11:57:52 +0000
parents e17a54c88806
children 7f4295a66bff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
3 /** @file toolbar_gui.cpp Code related to the (main) toolbar. */
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
4
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
5 #include "stdafx.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
6 #include "openttd.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
7 #include "gui.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
8 #include "window_gui.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
9 #include "window_func.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
10 #include "viewport_func.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
11 #include "command_func.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
12 #include "variables.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
13 #include "vehicle_gui.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
14 #include "rail_gui.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
15 #include "road_gui.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
16 #include "date_func.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
17 #include "vehicle_func.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
18 #include "sound_func.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
19 #include "terraform_gui.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
20 #include "transparency.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
21 #include "strings_func.h"
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
22 #include "company_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
23 #include "company_gui.h"
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
24 #include "vehicle_base.h"
8965
89de4625fe7d (svn r12757) -Codechange: move all cheat related stuff from all over the place to a single location.
rubidium <rubidium@openttd.org>
parents: 8726
diff changeset
25 #include "cheat_func.h"
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
26 #include "transparency_gui.h"
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
27 #include "screenshot.h"
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
28 #include "signs_func.h"
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
29 #include "fios.h"
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
30 #include "functions.h"
9336
5287277c4972 (svn r13228) -Codechange: split console.h.
rubidium <rubidium@openttd.org>
parents: 9333
diff changeset
31 #include "console_gui.h"
8977
9cfe40b47731 (svn r12769) -Codechange: some coding style cleanups.
rubidium <rubidium@openttd.org>
parents: 8975
diff changeset
32 #include "news_gui.h"
10696
7edccbb67398 (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
truebrain <truebrain@openttd.org>
parents: 10499
diff changeset
33 #include "ai/ai_gui.hpp"
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents: 9116
diff changeset
34 #include "tilehighlight_func.h"
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
35 #include "rail.h"
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
36 #include "widgets/dropdown_type.h"
10960
a4e5b5d2837c (svn r15299) -Cleanup: remove many redundant includes
smatz <smatz@openttd.org>
parents: 10919
diff changeset
37 #include "settings_type.h"
a4e5b5d2837c (svn r15299) -Cleanup: remove many redundant includes
smatz <smatz@openttd.org>
parents: 10919
diff changeset
38 #include "newgrf_config.h"
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
39
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
40 #include "network/network.h"
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
41 #include "network/network_gui.h"
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
42 #include "network/network_func.h"
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
43
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
44 #include "table/strings.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
45 #include "table/sprites.h"
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
46
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
47 static void SplitToolbar(Window *w);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
48
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
49 RailType _last_built_railtype;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
50 RoadType _last_built_roadtype;
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
51
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
52 /** This enum gathers properties of both toolbars */
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
53 enum ToolBarProperties {
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
54 TBP_BUTTONWIDTH = 22, ///< width of a button
9604
55cf78e96365 (svn r13646) -Change: typos and miss-aligned enum values
belugas <belugas@openttd.org>
parents: 9602
diff changeset
55 TBP_BUTTONHEIGHT = 22, ///< height of a button as well as the toolbars
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
56 TBP_DATEPANELWIDTH = 130, ///< used in scenario editor to calculate width of the toolbar.
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
57
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
58 TBP_TOOLBAR_MINBUTTON = 14, ///< references both toolbars
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
59 TBP_NORMAL_MAXBUTTON = 19, ///< normal toolbar has this many buttons
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
60 TBP_SCENARIO_MAXBUTTON = 16, ///< while the scenario has these
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
61 };
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
62
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
63 enum ToolbarMode {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
64 TB_NORMAL,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
65 TB_UPPER,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
66 TB_LOWER
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
67 };
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
68
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
69 enum ToolbarNormalWidgets {
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
70 TBN_PAUSE = 0,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
71 TBN_FASTFORWARD,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
72 TBN_SETTINGS,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
73 TBN_SAVEGAME,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
74 TBN_SMALLMAP,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
75 TBN_TOWNDIRECTORY,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
76 TBN_SUBSIDIES,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
77 TBN_STATIONS,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
78 TBN_FINANCES,
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
79 TBN_COMPANIES,
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
80 TBN_GRAPHICS,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
81 TBN_LEAGUE,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
82 TBN_INDUSTRIES,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
83 TBN_VEHICLESTART, ///< trains, actually. So following are trucks, boats and planes
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
84 TBN_TRAINS = TBN_VEHICLESTART,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
85 TBN_ROADVEHS,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
86 TBN_SHIPS,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
87 TBN_AIRCRAFTS,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
88 TBN_ZOOMIN,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
89 TBN_ZOOMOUT,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
90 TBN_RAILS,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
91 TBN_ROADS,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
92 TBN_WATER,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
93 TBN_AIR,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
94 TBN_LANDSCAPE,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
95 TBN_MUSICSOUND,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
96 TBN_NEWSREPORT,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
97 TBN_HELP,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
98 TBN_SWITCHBAR, ///< only available when toolbar has been split
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
99 };
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
100
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
101 enum ToolbarScenEditorWidgets {
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
102 TBSE_PAUSE = 0,
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
103 TBSE_FASTFORWARD,
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
104 TBSE_SAVESCENARIO = 3,
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
105 TBSE_SPACERPANEL,
9599
bfe46b72333f (svn r13641) -Fix: Misleading enum name.
belugas <belugas@openttd.org>
parents: 9588
diff changeset
106 TBSE_DATEPANEL,
9546
c1c73fc1a29d (svn r13561) -Codechange: two more enumifications of widgets
belugas <belugas@openttd.org>
parents: 9545
diff changeset
107 TBSE_DATEBACKWARD,
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
108 TBSE_DATEFORWARD,
9547
3510b3758252 (svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas <belugas@openttd.org>
parents: 9546
diff changeset
109 TBSE_SMALLMAP,
3510b3758252 (svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas <belugas@openttd.org>
parents: 9546
diff changeset
110 TBSE_ZOOMIN,
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
111 TBSE_ZOOMOUT,
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
112 TBSE_LANDGENERATE,
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
113 TBSE_TOWNGENERATE,
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
114 TBSE_INDUSTRYGENERATE,
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
115 TBSE_BUILDROAD,
9588
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
116 TBSE_BUILDDOCKS,
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
117 TBSE_PLANTTREES,
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
118 TBSE_PLACESIGNS,
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
119 };
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
120
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
121 /**
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
122 * Drop down list entry for showing a checked/unchecked toggle item.
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
123 */
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
124 class DropDownListCheckedItem : public DropDownListStringItem {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
125 public:
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
126 bool checked;
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
127
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
128 DropDownListCheckedItem(StringID string, int result, bool masked, bool checked) : DropDownListStringItem(string, result, masked), checked(checked) {}
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
129
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
130 virtual ~DropDownListCheckedItem() {}
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
131
11425
532a1c74074d (svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents: 11424
diff changeset
132 void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
133 {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
134 if (checked) {
11425
532a1c74074d (svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents: 11424
diff changeset
135 DrawString(left + 2, right - 2, top, STR_CHECKMARK, sel ? TC_WHITE : TC_BLACK);
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
136 }
11425
532a1c74074d (svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents: 11424
diff changeset
137 DrawString(left + 2, right - 2, top, this->String(), sel ? TC_WHITE : TC_BLACK);
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
138 }
9547
3510b3758252 (svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas <belugas@openttd.org>
parents: 9546
diff changeset
139 };
3510b3758252 (svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
belugas <belugas@openttd.org>
parents: 9546
diff changeset
140
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
141 /**
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
142 * Drop down list entry for showing a company entry, with companies 'blob'.
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
143 */
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
144 class DropDownListCompanyItem : public DropDownListItem {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
145 public:
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
146 bool greyed;
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
147
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
148 DropDownListCompanyItem(int result, bool masked, bool greyed) : DropDownListItem(result, masked), greyed(greyed) {}
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
149
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
150 virtual ~DropDownListCompanyItem() {}
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
151
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
152 bool Selectable() const
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
153 {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
154 return true;
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
155 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
156
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
157 uint Width() const
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
158 {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
159 char buffer[512];
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
160 CompanyID company = (CompanyID)result;
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
161 SetDParam(0, company);
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
162 SetDParam(1, company);
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
163 GetString(buffer, STR_COMPANY_NAME_COMPANY_NUM, lastof(buffer));
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
164 return GetStringBoundingBox(buffer).width + 19;
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
165 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
166
11425
532a1c74074d (svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents: 11424
diff changeset
167 void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
168 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
169 CompanyID company = (CompanyID)result;
12023
3c4566c47b2f (svn r16430) -Fix: crash when a company is deleted while a dropdown with company names is open
smatz <smatz@openttd.org>
parents: 11973
diff changeset
170
3c4566c47b2f (svn r16430) -Fix: crash when a company is deleted while a dropdown with company names is open
smatz <smatz@openttd.org>
parents: 11973
diff changeset
171 /* It's possible the company is deleted while the dropdown is open */
3c4566c47b2f (svn r16430) -Fix: crash when a company is deleted while a dropdown with company names is open
smatz <smatz@openttd.org>
parents: 11973
diff changeset
172 if (!Company::IsValidID(company)) return;
3c4566c47b2f (svn r16430) -Fix: crash when a company is deleted while a dropdown with company names is open
smatz <smatz@openttd.org>
parents: 11973
diff changeset
173
11425
532a1c74074d (svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents: 11424
diff changeset
174 DrawCompanyIcon(company, left + 2, top + 1);
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
175
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
176 SetDParam(0, company);
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
177 SetDParam(1, company);
11082
9ec1f7eac0a0 (svn r15425) -Codechange: some color->colour changes and type safety.
rubidium <rubidium@openttd.org>
parents: 11081
diff changeset
178 TextColour col;
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
179 if (this->greyed) {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
180 col = TC_GREY;
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
181 } else {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
182 col = sel ? TC_WHITE : TC_BLACK;
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
183 }
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
184 DrawString(left + 19, right - 2, top, STR_COMPANY_NAME_COMPANY_NUM, col);
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
185 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
186 };
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
187
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
188 /**
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
189 * Pop up a generic text only menu.
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
190 */
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
191 static void PopupMainToolbMenu(Window *w, int widget, StringID string, int count)
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
192 {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
193 DropDownList *list = new DropDownList();
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
194 for (int i = 0; i < count; i++) {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
195 list->push_back(new DropDownListStringItem(string + i, i, false));
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
196 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
197 ShowDropDownList(w, list, 0, widget, 140, true, true);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
198 SndPlayFx(SND_15_BEEP);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
199 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
200
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
201 /** Enum for the Company Toolbar's network related buttons */
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
202 enum {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
203 CTMN_CLIENT_LIST = -1, ///< Show the client list
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
204 CTMN_NEW_COMPANY = -2, ///< Create a new company
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
205 CTMN_SPECTATE = -3, ///< Become spectator
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
206 };
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
207
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
208 /**
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
209 * Pop up a generic company list menu.
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
210 */
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
211 static void PopupMainCompanyToolbMenu(Window *w, int widget, int grey = 0)
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
212 {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
213 DropDownList *list = new DropDownList();
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
214
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
215 #ifdef ENABLE_NETWORK
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
216 if (widget == TBN_COMPANIES && _networking) {
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
217 /* Add the client list button for the companies menu */
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
218 list->push_back(new DropDownListStringItem(STR_NETWORK_CLIENT_LIST, CTMN_CLIENT_LIST, false));
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
219
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
220 if (_local_company == COMPANY_SPECTATOR) {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
221 list->push_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_NEW_COMPANY, CTMN_NEW_COMPANY, NetworkMaxCompaniesReached()));
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
222 } else {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
223 list->push_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_SPECTATE, CTMN_SPECTATE, NetworkMaxSpectatorsReached()));
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
224 }
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
225 }
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
226 #endif /* ENABLE_NETWORK */
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
227
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
228 for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
229 if (!Company::IsValidID(c)) continue;
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
230 list->push_back(new DropDownListCompanyItem(c, false, HasBit(grey, c)));
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
231 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
232
10919
da942a9c581b (svn r15254) -Fix (r15242): of course MSVC requires a cast
glx <glx@openttd.org>
parents: 10907
diff changeset
233 ShowDropDownList(w, list, _local_company == COMPANY_SPECTATOR ? CTMN_CLIENT_LIST : (int)_local_company, widget, 240, true, true);
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
234 SndPlayFx(SND_15_BEEP);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
235 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
236
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
237
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
238 static ToolbarMode _toolbar_mode;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
239
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
240 static void SelectSignTool()
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
241 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
242 if (_cursor.sprite == SPR_CURSOR_SIGN) {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
243 ResetObjectToPlace();
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
244 } else {
11702
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11524
diff changeset
245 SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
246 _place_proc = PlaceProc_Sign;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
247 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
248 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
249
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
250 /* --- Pausing --- */
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
251
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
252 static void ToolbarPauseClick(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
253 {
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
254 if (_networking && !_network_server) return; // only server can pause the game
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
255
11852
862dd1024fe7 (svn r16242) -Codechange: rework pausing
rubidium <rubidium@openttd.org>
parents: 11730
diff changeset
256 if (DoCommandP(0, PM_PAUSED_NORMAL, _pause_mode == PM_UNPAUSED, CMD_PAUSE)) SndPlayFx(SND_15_BEEP);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
257 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
258
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
259 /* --- Fast forwarding --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
260
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
261 static void ToolbarFastForwardClick(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
262 {
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
263 _fast_forward ^= true;
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
264 SndPlayFx(SND_15_BEEP);
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
265 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
266
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
267 /* --- Options button menu --- */
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
268
9544
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
269 enum OptionMenuEntries {
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
270 OME_GAMEOPTIONS,
9544
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
271 OME_DIFFICULTIES,
11069
36d798171bfd (svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents: 10996
diff changeset
272 OME_SETTINGS,
9544
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
273 OME_NEWGRFSETTINGS,
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
274 OME_TRANSPARENCIES,
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
275 OME_SHOW_TOWNNAMES,
9544
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
276 OME_SHOW_STATIONNAMES,
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
277 OME_SHOW_SIGNS,
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
278 OME_SHOW_WAYPOINTNAMES,
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
279 OME_FULL_ANIMATION,
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
280 OME_FULL_DETAILS,
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
281 OME_TRANSPARENTBUILDINGS,
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
282 OME_SHOW_STATIONSIGNS,
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
283 };
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
284
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
285 static void ToolbarOptionsClick(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
286 {
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
287 DropDownList *list = new DropDownList();
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
288 list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_GAME_OPTIONS, OME_GAMEOPTIONS, false));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
289 list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_DIFFICULTY_SETTINGS, OME_DIFFICULTIES, false));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
290 list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_CONFIG_SETTINGS, OME_SETTINGS, false));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
291 list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_NEWGRF_SETTINGS, OME_NEWGRFSETTINGS, false));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
292 list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS, OME_TRANSPARENCIES, false));
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
293 list->push_back(new DropDownListItem(-1, false));
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
294 list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TOWN_NAMES_DISPLAYED, OME_SHOW_TOWNNAMES, false, HasBit(_display_opt, DO_SHOW_TOWN_NAMES)));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
295 list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_STATION_NAMES_DISPLAYED, OME_SHOW_STATIONNAMES, false, HasBit(_display_opt, DO_SHOW_STATION_NAMES)));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
296 list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_SIGNS_DISPLAYED, OME_SHOW_SIGNS, false, HasBit(_display_opt, DO_SHOW_SIGNS)));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
297 list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_WAYPOINTS_DISPLAYED, OME_SHOW_WAYPOINTNAMES, false, HasBit(_display_opt, DO_WAYPOINTS)));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
298 list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_ANIMATION, OME_FULL_ANIMATION, false, HasBit(_display_opt, DO_FULL_ANIMATION)));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
299 list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_DETAIL, OME_FULL_DETAILS, false, HasBit(_display_opt, DO_FULL_DETAIL)));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
300 list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_BUILDINGS, OME_TRANSPARENTBUILDINGS, false, IsTransparencySet(TO_HOUSES)));
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
301 list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_SIGNS, OME_SHOW_STATIONSIGNS, false, IsTransparencySet(TO_SIGNS)));
9240
5cedbfe95435 (svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium <rubidium@openttd.org>
parents: 9195
diff changeset
302
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
303 ShowDropDownList(w, list, 0, TBN_SETTINGS, 140, true, true);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
304 SndPlayFx(SND_15_BEEP);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
305 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
306
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
307 static void MenuClickSettings(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
308 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
309 switch (index) {
9544
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
310 case OME_GAMEOPTIONS: ShowGameOptions(); return;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
311 case OME_DIFFICULTIES: ShowGameDifficulty(); return;
11069
36d798171bfd (svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents: 10996
diff changeset
312 case OME_SETTINGS: ShowGameSettings(); return;
9544
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
313 case OME_NEWGRFSETTINGS: ShowNewGRFSettings(!_networking, true, true, &_grfconfig); return;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
314 case OME_TRANSPARENCIES: ShowTransparencyToolbar(); break;
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
315
9544
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
316 case OME_SHOW_TOWNNAMES: ToggleBit(_display_opt, DO_SHOW_TOWN_NAMES); break;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
317 case OME_SHOW_STATIONNAMES: ToggleBit(_display_opt, DO_SHOW_STATION_NAMES); break;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
318 case OME_SHOW_SIGNS: ToggleBit(_display_opt, DO_SHOW_SIGNS); break;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
319 case OME_SHOW_WAYPOINTNAMES: ToggleBit(_display_opt, DO_WAYPOINTS); break;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
320 case OME_FULL_ANIMATION: ToggleBit(_display_opt, DO_FULL_ANIMATION); break;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
321 case OME_FULL_DETAILS: ToggleBit(_display_opt, DO_FULL_DETAIL); break;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
322 case OME_TRANSPARENTBUILDINGS: ToggleTransparency(TO_HOUSES); break;
59c4a6811a60 (svn r13559) -Codechange: Enumification of the Options menu items
belugas <belugas@openttd.org>
parents: 9541
diff changeset
323 case OME_SHOW_STATIONSIGNS: ToggleTransparency(TO_SIGNS); break;
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
324 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
325 MarkWholeScreenDirty();
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
326 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
327
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
328 /* --- Saving/loading button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
329
9566
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
330 enum SaveLoadEditorMenuEntries {
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
331 SLEME_SAVE_SCENARIO = 0,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
332 SLEME_LOAD_SCENARIO,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
333 SLEME_LOAD_HEIGHTMAP,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
334 SLEME_EXIT_TOINTRO,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
335 SLEME_EXIT_GAME = 5,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
336 SLEME_MENUCOUNT,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
337 };
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
338
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
339 enum SaveLoadNormalMenuEntries {
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
340 SLNME_SAVE_GAME = 0,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
341 SLNME_LOAD_GAME,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
342 SLNME_EXIT_TOINTRO,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
343 SLNME_EXIT_GAME,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
344 SLNME_MENUCOUNT,
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
345 };
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
346
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
347 static void ToolbarSaveClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
348 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
349 PopupMainToolbMenu(w, TBN_SAVEGAME, STR_FILE_MENU_SAVE_GAME, SLNME_MENUCOUNT);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
350 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
351
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
352 static void ToolbarScenSaveOrLoad(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
353 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
354 PopupMainToolbMenu(w, TBSE_SAVESCENARIO, STR_SCENEDIT_FILE_MENU_SAVE_SCENARIO, SLEME_MENUCOUNT);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
355 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
356
9610
9fef7cbc9e5b (svn r13663) -Codechange: Use a default parameter, hoping to reduce the different signatures of functions in menus
belugas <belugas@openttd.org>
parents: 9607
diff changeset
357 static void MenuClickSaveLoad(int index = 0)
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
358 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
359 if (_game_mode == GM_EDITOR) {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
360 switch (index) {
9566
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
361 case SLEME_SAVE_SCENARIO: ShowSaveLoadDialog(SLD_SAVE_SCENARIO); break;
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
362 case SLEME_LOAD_SCENARIO: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
363 case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break;
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
364 case SLEME_EXIT_TOINTRO: AskExitToGameMenu(); break;
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
365 case SLEME_EXIT_GAME: HandleExitGameRequest(); break;
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
366 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
367 } else {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
368 switch (index) {
9566
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
369 case SLNME_SAVE_GAME: ShowSaveLoadDialog(SLD_SAVE_GAME); break;
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
370 case SLNME_LOAD_GAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
371 case SLNME_EXIT_TOINTRO: AskExitToGameMenu(); break;
198b2ae346b4 (svn r13590) -Codechange: Enumification of the Save/Load menu items
belugas <belugas@openttd.org>
parents: 9564
diff changeset
372 case SLNME_EXIT_GAME: HandleExitGameRequest(); break;
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
373 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
374 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
375 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
376
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
377 /* --- Map button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
378
9571
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
379 enum MapMenuEntries {
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
380 MME_SHOW_SMALLMAP = 0,
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
381 MME_SHOW_EXTRAVIEWPORTS,
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
382 MME_SHOW_SIGNLISTS,
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
383 MME_SHOW_TOWNDIRECTORY, ///< This entry is only used in Editor mode
9604
55cf78e96365 (svn r13646) -Change: typos and miss-aligned enum values
belugas <belugas@openttd.org>
parents: 9602
diff changeset
384 MME_MENUCOUNT_NORMAL = 3,
55cf78e96365 (svn r13646) -Change: typos and miss-aligned enum values
belugas <belugas@openttd.org>
parents: 9602
diff changeset
385 MME_MENUCOUNT_EDITOR = 4,
9571
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
386 };
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
387
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
388 static void ToolbarMapClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
389 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
390 PopupMainToolbMenu(w, TBN_SMALLMAP, STR_MAP_MENU_MAP_OF_WORLD, MME_MENUCOUNT_NORMAL);
9571
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
391 }
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
392
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
393 static void ToolbarScenMapTownDir(Window *w)
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
394 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
395 PopupMainToolbMenu(w, TBSE_SMALLMAP, STR_MAP_MENU_MAP_OF_WORLD, MME_MENUCOUNT_EDITOR);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
396 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
397
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
398 static void MenuClickMap(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
399 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
400 switch (index) {
9571
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
401 case MME_SHOW_SMALLMAP: ShowSmallMap(); break;
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
402 case MME_SHOW_EXTRAVIEWPORTS: ShowExtraViewPortWindow(); break;
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
403 case MME_SHOW_SIGNLISTS: ShowSignList(); break;
481237bb59f9 (svn r13597) -Codechange: Enumification of the Map menu items.
belugas <belugas@openttd.org>
parents: 9566
diff changeset
404 case MME_SHOW_TOWNDIRECTORY: if (_game_mode == GM_EDITOR) ShowTownDirectory(); break;
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
405 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
406 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
407
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
408 /* --- Town button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
409
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
410 static void ToolbarTownClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
411 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
412 PopupMainToolbMenu(w, TBN_TOWNDIRECTORY, STR_TOWN_MENU_TOWN_DIRECTORY, 1);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
413 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
414
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
415 static void MenuClickTown(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
416 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
417 ShowTownDirectory();
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
418 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
419
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
420 /* --- Subidies button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
421
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
422 static void ToolbarSubsidiesClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
423 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
424 PopupMainToolbMenu(w, TBN_SUBSIDIES, STR_SUBSIDIES_MENU_SUBSIDIES, 1);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
425 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
426
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
427 static void MenuClickSubsidies(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
428 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
429 ShowSubsidiesList();
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
430 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
431
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
432 /* --- Stations button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
433
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
434 static void ToolbarStationsClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
435 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
436 PopupMainCompanyToolbMenu(w, TBN_STATIONS);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
437 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
438
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
439 static void MenuClickStations(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
440 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
441 ShowCompanyStations((CompanyID)index);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
442 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
443
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
444 /* --- Finances button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
445
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
446 static void ToolbarFinancesClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
447 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
448 PopupMainCompanyToolbMenu(w, TBN_FINANCES);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
449 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
450
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
451 static void MenuClickFinances(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
452 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
453 ShowCompanyFinances((CompanyID)index);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
454 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
455
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
456 /* --- Company's button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
457
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
458 static void ToolbarCompaniesClick(Window *w)
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
459 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
460 PopupMainCompanyToolbMenu(w, TBN_COMPANIES);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
461 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
462
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
463 static void MenuClickCompany(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
464 {
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
465 #ifdef ENABLE_NETWORK
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
466 if (_networking) {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
467 switch (index) {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
468 case CTMN_CLIENT_LIST:
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
469 ShowClientList();
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
470 return;
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
471
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
472 case CTMN_NEW_COMPANY:
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
473 if (_network_server) {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
474 DoCommandP(0, 0, _network_own_client_id, CMD_COMPANY_CTRL);
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
475 } else {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
476 NetworkSend_Command(0, 0, 0, CMD_COMPANY_CTRL, NULL, NULL);
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
477 }
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
478 return;
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
479
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
480 case CTMN_SPECTATE:
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
481 if (_network_server) {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
482 NetworkServerDoMove(CLIENT_ID_SERVER, COMPANY_SPECTATOR);
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
483 MarkWholeScreenDirty();
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
484 } else {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
485 NetworkClientRequestMove(COMPANY_SPECTATOR);
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
486 }
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
487 return;
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
488 }
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
489 }
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
490 #endif /* ENABLE_NETWORK */
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10696
diff changeset
491 ShowCompany((CompanyID)index);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
492 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
493
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
494 /* --- Graphs button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
495
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
496 static void ToolbarGraphsClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
497 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
498 PopupMainToolbMenu(w, TBN_GRAPHICS, STR_GRAPH_MENU_OPERATING_PROFIT_GRAPH, (_toolbar_mode == TB_NORMAL) ? 6 : 8);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
499 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
500
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
501 static void MenuClickGraphs(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
502 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
503 switch (index) {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
504 case 0: ShowOperatingProfitGraph(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
505 case 1: ShowIncomeGraph(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
506 case 2: ShowDeliveredCargoGraph(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
507 case 3: ShowPerformanceHistoryGraph(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
508 case 4: ShowCompanyValueGraph(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
509 case 5: ShowCargoPaymentRates(); break;
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
510 /* functions for combined graphs/league button */
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
511 case 6: ShowCompanyLeagueTable(); break;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
512 case 7: ShowPerformanceRatingDetail(); break;
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
513 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
514 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
515
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
516 /* --- League button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
517
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
518 static void ToolbarLeagueClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
519 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
520 PopupMainToolbMenu(w, TBN_LEAGUE, STR_GRAPH_MENU_COMPANY_LEAGUE_TABLE, 2);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
521 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
522
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
523 static void MenuClickLeague(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
524 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
525 switch (index) {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
526 case 0: ShowCompanyLeagueTable(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
527 case 1: ShowPerformanceRatingDetail(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
528 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
529 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
530
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
531 /* --- Industries button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
532
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
533 static void ToolbarIndustryClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
534 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
535 /* Disable build-industry menu if we are a spectator */
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
536 PopupMainToolbMenu(w, TBN_INDUSTRIES, STR_INDUSTRY_MENU_INDUSTRY_DIRECTORY, (_local_company == COMPANY_SPECTATOR) ? 1 : 2);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
537 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
538
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
539 static void MenuClickIndustry(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
540 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
541 switch (index) {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
542 case 0: ShowIndustryDirectory(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
543 case 1: ShowBuildIndustryWindow(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
544 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
545 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
546
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
547 /* --- Trains button menu + 1 helper function for all vehicles. --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
548
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
549 static void ToolbarVehicleClick(Window *w, VehicleType veh)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
550 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
551 const Vehicle *v;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
552 int dis = ~0;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
553
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
554 FOR_ALL_VEHICLES(v) {
9053
36e24a113ccc (svn r12892) -Fix: too many items in the vehicle toolbars were greyed out.
rubidium <rubidium@openttd.org>
parents: 9014
diff changeset
555 if (v->type == veh && v->IsPrimaryVehicle()) ClrBit(dis, v->owner);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
556 }
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
557 PopupMainCompanyToolbMenu(w, TBN_VEHICLESTART + veh, dis);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
558 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
559
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
560
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
561 static void ToolbarTrainClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
562 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
563 ToolbarVehicleClick(w, VEH_TRAIN);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
564 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
565
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
566 static void MenuClickShowTrains(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
567 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
568 ShowVehicleListWindow((CompanyID)index, VEH_TRAIN);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
569 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
570
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
571 /* --- Road vehicle button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
572
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
573 static void ToolbarRoadClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
574 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
575 ToolbarVehicleClick(w, VEH_ROAD);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
576 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
577
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
578 static void MenuClickShowRoad(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
579 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
580 ShowVehicleListWindow((CompanyID)index, VEH_ROAD);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
581 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
582
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
583 /* --- Ship button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
584
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
585 static void ToolbarShipClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
586 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
587 ToolbarVehicleClick(w, VEH_SHIP);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
588 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
589
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
590 static void MenuClickShowShips(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
591 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
592 ShowVehicleListWindow((CompanyID)index, VEH_SHIP);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
593 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
594
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
595 /* --- Aircraft button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
596
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
597 static void ToolbarAirClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
598 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
599 ToolbarVehicleClick(w, VEH_AIRCRAFT);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
600 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
601
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
602 static void MenuClickShowAir(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
603 {
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
604 ShowVehicleListWindow((CompanyID)index, VEH_AIRCRAFT);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
605 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
606
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
607 /* --- Zoom in button --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
608
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
609 static void ToolbarZoomInClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
610 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
611 if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) {
9616
e183bfef543f (svn r13672) -Fix(r13670): silent warnings that MSVC did not raised. Looks like enums can not be easily matched :(
belugas <belugas@openttd.org>
parents: 9614
diff changeset
612 w->HandleButtonClick((_game_mode == GM_EDITOR) ? (byte)TBSE_ZOOMIN : (byte)TBN_ZOOMIN);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
613 SndPlayFx(SND_15_BEEP);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
614 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
615 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
616
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
617 /* --- Zoom out button --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
618
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
619 static void ToolbarZoomOutClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
620 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
621 if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) {
9616
e183bfef543f (svn r13672) -Fix(r13670): silent warnings that MSVC did not raised. Looks like enums can not be easily matched :(
belugas <belugas@openttd.org>
parents: 9614
diff changeset
622 w->HandleButtonClick((_game_mode == GM_EDITOR) ? (byte)TBSE_ZOOMOUT : (byte)TBN_ZOOMOUT);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
623 SndPlayFx(SND_15_BEEP);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
624 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
625 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
626
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
627 /* --- Rail button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
628
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
629 static void ToolbarBuildRailClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
630 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11919
diff changeset
631 const Company *c = Company::Get(_local_company);
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
632 DropDownList *list = new DropDownList();
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
633 for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
634 const RailtypeInfo *rti = GetRailTypeInfo(rt);
11102
ee125c12be2b (svn r15448) -Codechange: Don't show rail types in selection drop downs if they have no label.
peter1138 <peter1138@openttd.org>
parents: 11082
diff changeset
635 /* Skip rail type if it has no label */
ee125c12be2b (svn r15448) -Codechange: Don't show rail types in selection drop downs if they have no label.
peter1138 <peter1138@openttd.org>
parents: 11082
diff changeset
636 if (rti->label == 0) continue;
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
637 list->push_back(new DropDownListStringItem(rti->strings.menu_text, rt, !HasBit(c->avail_railtypes, rt)));
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
638 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
639 ShowDropDownList(w, list, _last_built_railtype, TBN_RAILS, 140, true, true);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
640 SndPlayFx(SND_15_BEEP);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
641 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
642
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
643 static void MenuClickBuildRail(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
644 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
645 _last_built_railtype = (RailType)index;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
646 ShowBuildRailToolbar(_last_built_railtype, -1);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
647 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
648
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
649 /* --- Road button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
650
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
651 static void ToolbarBuildRoadClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
652 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11919
diff changeset
653 const Company *c = Company::Get(_local_company);
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
654 DropDownList *list = new DropDownList();
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
655 for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
656 /* The standard road button is *always* available */
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
657 list->push_back(new DropDownListStringItem(STR_ROAD_MENU_ROAD_CONSTRUCTION + rt, rt, !(HasBit(c->avail_roadtypes, rt) || rt == ROADTYPE_ROAD)));
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
658 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
659 ShowDropDownList(w, list, _last_built_roadtype, TBN_ROADS, 140, true, true);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
660 SndPlayFx(SND_15_BEEP);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
661 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
662
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
663 static void MenuClickBuildRoad(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
664 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
665 _last_built_roadtype = (RoadType)index;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
666 ShowBuildRoadToolbar(_last_built_roadtype);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
667 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
668
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
669 /* --- Water button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
670
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
671 static void ToolbarBuildWaterClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
672 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
673 PopupMainToolbMenu(w, TBN_WATER, STR_WATERWAYS_MENU_WATERWAYS_CONSTRUCTION, 1);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
674 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
675
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
676 static void MenuClickBuildWater(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
677 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
678 ShowBuildDocksToolbar();
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
679 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
680
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
681 /* --- Airport button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
682
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
683 static void ToolbarBuildAirClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
684 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
685 PopupMainToolbMenu(w, TBN_AIR, STR_AIRCRAFT_MENU_AIRPORT_CONSTRUCTION, 1);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
686 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
687
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
688 static void MenuClickBuildAir(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
689 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
690 ShowBuildAirToolbar();
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
691 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
692
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
693 /* --- Forest button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
694
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
695 static void ToolbarForestClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
696 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
697 PopupMainToolbMenu(w, TBN_LANDSCAPE, STR_LANDSCAPING_MENU_LANDSCAPING, 3);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
698 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
699
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
700 static void MenuClickForest(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
701 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
702 switch (index) {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
703 case 0: ShowTerraformToolbar(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
704 case 1: ShowBuildTreesToolbar(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
705 case 2: SelectSignTool(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
706 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
707 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
708
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
709 /* --- Music button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
710
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
711 static void ToolbarMusicClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
712 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
713 PopupMainToolbMenu(w, TBN_MUSICSOUND, STR_TOOLBAR_SOUND_MUSIC, 1);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
714 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
715
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
716 static void MenuClickMusicWindow(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
717 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
718 ShowMusicWindow();
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
719 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
720
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
721 /* --- Newspaper button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
722
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
723 static void ToolbarNewspaperClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
724 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
725 PopupMainToolbMenu(w, TBN_NEWSREPORT, STR_NEWS_MENU_LAST_MESSAGE_NEWS_REPORT, 3);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
726 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
727
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
728 static void MenuClickNewspaper(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
729 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
730 switch (index) {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
731 case 0: ShowLastNewsMessage(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
732 case 1: ShowMessageOptions(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
733 case 2: ShowMessageHistory(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
734 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
735 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
736
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
737 /* --- Help button menu --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
738
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
739 static void ToolbarHelpClick(Window *w)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
740 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
741 PopupMainToolbMenu(w, TBN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, 7);
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
742 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
743
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
744 static void MenuClickSmallScreenshot()
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
745 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
746 SetScreenshotType(SC_VIEWPORT);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
747 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
748
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
749 static void MenuClickWorldScreenshot()
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
750 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
751 SetScreenshotType(SC_WORLD);
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
752 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
753
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
754 static void MenuClickHelp(int index)
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
755 {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
756 switch (index) {
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
757 case 0: PlaceLandBlockInfo(); break;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
758 case 2: IConsoleSwitch(); break;
10696
7edccbb67398 (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
truebrain <truebrain@openttd.org>
parents: 10499
diff changeset
759 case 3: ShowAIDebugWindow(); break;
7edccbb67398 (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
truebrain <truebrain@openttd.org>
parents: 10499
diff changeset
760 case 4: MenuClickSmallScreenshot(); break;
7edccbb67398 (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
truebrain <truebrain@openttd.org>
parents: 10499
diff changeset
761 case 5: MenuClickWorldScreenshot(); break;
7edccbb67398 (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
truebrain <truebrain@openttd.org>
parents: 10499
diff changeset
762 case 6: ShowAboutWindow(); break;
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
763 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
764 }
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
765
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
766 /* --- Switch toolbar button --- */
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
767
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
768 static void ToolbarSwitchClick(Window *w)
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
769 {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
770 if (_toolbar_mode != TB_LOWER) {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
771 _toolbar_mode = TB_LOWER;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
772 } else {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
773 _toolbar_mode = TB_UPPER;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
774 }
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
775
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
776 SplitToolbar(w);
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
777 w->HandleButtonClick(TBN_SWITCHBAR);
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
778 SetWindowDirty(w);
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
779 SndPlayFx(SND_15_BEEP);
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
780 }
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
781
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
782 /* --- Scenario editor specific handlers. */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
783
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
784 static void ToolbarScenDateBackward(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
785 {
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
786 /* don't allow too fast scrolling */
10180
e024f1d28082 (svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents: 10101
diff changeset
787 if ((w->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
788 w->HandleButtonClick(TBSE_DATEBACKWARD);
9116
44beb31166aa (svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium <rubidium@openttd.org>
parents: 9115
diff changeset
789 w->SetDirty();
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
790
11919
5a02b0ed51bc (svn r16321) -Fix (r5946): in the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios.
rubidium <rubidium@openttd.org>
parents: 11852
diff changeset
791 _settings_game.game_creation.starting_year = Clamp(_settings_game.game_creation.starting_year - 1, MIN_YEAR, MAX_YEAR);
5a02b0ed51bc (svn r16321) -Fix (r5946): in the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios.
rubidium <rubidium@openttd.org>
parents: 11852
diff changeset
792 SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
793 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
794 _left_button_clicked = false;
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
795 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
796
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
797 static void ToolbarScenDateForward(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
798 {
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
799 /* don't allow too fast scrolling */
10180
e024f1d28082 (svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents: 10101
diff changeset
800 if ((w->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
801 w->HandleButtonClick(TBSE_DATEFORWARD);
9116
44beb31166aa (svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium <rubidium@openttd.org>
parents: 9115
diff changeset
802 w->SetDirty();
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
803
11919
5a02b0ed51bc (svn r16321) -Fix (r5946): in the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios.
rubidium <rubidium@openttd.org>
parents: 11852
diff changeset
804 _settings_game.game_creation.starting_year = Clamp(_settings_game.game_creation.starting_year + 1, MIN_YEAR, MAX_YEAR);
5a02b0ed51bc (svn r16321) -Fix (r5946): in the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios.
rubidium <rubidium@openttd.org>
parents: 11852
diff changeset
805 SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
806 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
807 _left_button_clicked = false;
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
808 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
809
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
810 static void ToolbarScenGenLand(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
811 {
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
812 w->HandleButtonClick(TBSE_LANDGENERATE);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
813 SndPlayFx(SND_15_BEEP);
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
814
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
815 ShowEditorTerraformToolbar();
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
816 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
817
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
818
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
819 static void ToolbarScenGenTown(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
820 {
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
821 w->HandleButtonClick(TBSE_TOWNGENERATE);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
822 SndPlayFx(SND_15_BEEP);
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
823 ShowBuildTownWindow();
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
824 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
825
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
826 static void ToolbarScenGenIndustry(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
827 {
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
828 w->HandleButtonClick(TBSE_INDUSTRYGENERATE);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
829 SndPlayFx(SND_15_BEEP);
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
830 ShowBuildIndustryWindow();
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
831 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
832
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
833 static void ToolbarScenBuildRoad(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
834 {
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
835 w->HandleButtonClick(TBSE_BUILDROAD);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
836 SndPlayFx(SND_15_BEEP);
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
837 ShowBuildRoadScenToolbar();
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
838 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
839
9588
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
840 static void ToolbarScenBuildDocks(Window *w)
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
841 {
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
842 w->HandleButtonClick(TBSE_BUILDDOCKS);
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
843 SndPlayFx(SND_15_BEEP);
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
844 ShowBuildDocksScenToolbar();
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
845 }
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
846
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
847 static void ToolbarScenPlantTrees(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
848 {
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
849 w->HandleButtonClick(TBSE_PLANTTREES);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
850 SndPlayFx(SND_15_BEEP);
9195
35451e3679a6 (svn r13061) -Codechange: make a class of the BuildTreesWindow.
glx <glx@openttd.org>
parents: 9165
diff changeset
851 ShowBuildTreesToolbar();
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
852 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
853
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
854 static void ToolbarScenPlaceSign(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
855 {
9519
0b6d50520123 (svn r13515) -Codechange: Widget enumification for scenario editor
belugas <belugas@openttd.org>
parents: 9518
diff changeset
856 w->HandleButtonClick(TBSE_PLACESIGNS);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
857 SndPlayFx(SND_15_BEEP);
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
858 SelectSignTool();
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
859 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
860
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
861 static void ToolbarBtn_NULL(Window *w)
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
862 {
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
863 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
864
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
865 /* --- Resizing the toolbar */
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
866
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
867 static void ResizeToolbar(Window *w)
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
868 {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
869 /* There are 27 buttons plus some spacings if the space allows it */
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
870 uint button_width;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
871 uint spacing;
9541
c01401030813 (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 <belugas@openttd.org>
parents: 9539
diff changeset
872 uint widgetcount = w->widget_count - 1;
c01401030813 (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 <belugas@openttd.org>
parents: 9539
diff changeset
873
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
874 if (w->width >= (int)widgetcount * TBP_BUTTONWIDTH) {
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
875 button_width = TBP_BUTTONWIDTH;
9541
c01401030813 (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 <belugas@openttd.org>
parents: 9539
diff changeset
876 spacing = w->width - (widgetcount * button_width);
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
877 } else {
9541
c01401030813 (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 <belugas@openttd.org>
parents: 9539
diff changeset
878 button_width = w->width / widgetcount;
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
879 spacing = 0;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
880 }
9538
3d5d274df81c (svn r13542) -Codechange: Less a few more magic numbers and a code a bit more adaptable, still
belugas <belugas@openttd.org>
parents: 9537
diff changeset
881
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
882 static const uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 };
9538
3d5d274df81c (svn r13542) -Codechange: Less a few more magic numbers and a code a bit more adaptable, still
belugas <belugas@openttd.org>
parents: 9537
diff changeset
883 uint i = 0;
9541
c01401030813 (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 <belugas@openttd.org>
parents: 9539
diff changeset
884 for (uint x = 0, j = 0; i < widgetcount; i++) {
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
885 if (extra_spacing_at[j] == i) {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
886 j++;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
887 uint add = spacing / (lengthof(extra_spacing_at) - j);
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
888 spacing -= add;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
889 x += add;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
890 }
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
891
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
892 w->widget[i].type = WWT_IMGBTN;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
893 w->widget[i].left = x;
9541
c01401030813 (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 <belugas@openttd.org>
parents: 9539
diff changeset
894 x += (spacing != 0) ? button_width : (w->width - x) / (widgetcount - i);
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
895 w->widget[i].right = x - 1;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
896 }
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
897
9538
3d5d274df81c (svn r13542) -Codechange: Less a few more magic numbers and a code a bit more adaptable, still
belugas <belugas@openttd.org>
parents: 9537
diff changeset
898 w->widget[i].type = WWT_EMPTY; // i now points to the last item
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
899 _toolbar_mode = TB_NORMAL;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
900 }
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
901
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
902 /* --- Split the toolbar */
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
903
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
904 static void SplitToolbar(Window *w)
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
905 {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
906 static const byte arrange14[] = {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
907 0, 1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
908 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 24, 25, 26, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
909 };
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
910 static const byte arrange15[] = {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
911 0, 1, 4, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
912 0, 2, 4, 3, 5, 6, 7, 8, 9, 10, 12, 24, 25, 26, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
913 };
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
914 static const byte arrange16[] = {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
915 0, 1, 2, 4, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
916 0, 1, 3, 5, 6, 7, 8, 9, 10, 12, 24, 25, 26, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
917 };
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
918 static const byte arrange17[] = {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
919 0, 1, 2, 4, 6, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
920 0, 1, 3, 4, 6, 5, 7, 8, 9, 10, 12, 24, 25, 26, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
921 };
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
922 static const byte arrange18[] = {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
923 0, 1, 2, 4, 5, 6, 7, 8, 9, 12, 19, 20, 21, 22, 23, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
924 0, 1, 3, 4, 5, 6, 7, 10, 13, 14, 15, 16, 24, 25, 26, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
925 };
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
926 static const byte arrange19[] = {
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
927 0, 1, 2, 4, 5, 6, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
928 0, 1, 3, 4, 7, 8, 9, 10, 12, 25, 19, 20, 21, 22, 23, 26, 17, 18, 27,
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
929 };
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
930
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
931 static const byte *arrangements[] = { arrange14, arrange15, arrange16, arrange17, arrange18, arrange19 };
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
932
9602
62ede9607d98 (svn r13644) -Fix(r13643): compare an apple with an apple. MSVC seems to not care, but some other compilers do.
belugas <belugas@openttd.org>
parents: 9601
diff changeset
933 uint max_icons = max(TBP_TOOLBAR_MINBUTTON, (ToolBarProperties)((w->width + TBP_BUTTONWIDTH / 2) / TBP_BUTTONWIDTH));
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
934
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
935 assert(max_icons >= TBP_TOOLBAR_MINBUTTON && max_icons <= TBP_NORMAL_MAXBUTTON);
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
936
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
937 /* first hide all icons */
9541
c01401030813 (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 <belugas@openttd.org>
parents: 9539
diff changeset
938 for (uint i = 0; i < w->widget_count - 1; i++) {
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
939 w->widget[i].type = WWT_EMPTY;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
940 }
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
941
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
942 /* now activate them all on their proper positions */
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
943 for (uint i = 0, x = 0, n = max_icons - TBP_TOOLBAR_MINBUTTON; i < max_icons; i++) {
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
944 uint icon = arrangements[n][i + ((_toolbar_mode == TB_LOWER) ? max_icons : 0)];
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
945 w->widget[icon].type = WWT_IMGBTN;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
946 w->widget[icon].left = x;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
947 x += (w->width - x) / (max_icons - i);
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
948 w->widget[icon].right = x - 1;
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
949 }
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
950 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
951
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
952 typedef void MenuClickedProc(int index);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
953
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
954 static MenuClickedProc * const _menu_clicked_procs[] = {
11368
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
955 NULL, // 0
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
956 NULL, // 1
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
957 MenuClickSettings, // 2
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
958 MenuClickSaveLoad, // 3
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
959 MenuClickMap, // 4
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
960 MenuClickTown, // 5
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
961 MenuClickSubsidies, // 6
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
962 MenuClickStations, // 7
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
963 MenuClickFinances, // 8
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
964 MenuClickCompany, // 9
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
965 MenuClickGraphs, // 10
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
966 MenuClickLeague, // 11
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
967 MenuClickIndustry, // 12
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
968 MenuClickShowTrains, // 13
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
969 MenuClickShowRoad, // 14
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
970 MenuClickShowShips, // 15
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
971 MenuClickShowAir, // 16
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
972 MenuClickMap, // 17
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
973 NULL, // 18
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
974 MenuClickBuildRail, // 19
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
975 MenuClickBuildRoad, // 20
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
976 MenuClickBuildWater, // 21
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
977 MenuClickBuildAir, // 22
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
978 MenuClickForest, // 23
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
979 MenuClickMusicWindow, // 24
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
980 MenuClickNewspaper, // 25
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
981 MenuClickHelp, // 26
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
982 };
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
983
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
984 /* --- Toolbar handling for the 'normal' case */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
985
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
986 typedef void ToolbarButtonProc(Window *w);
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
987
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
988 static ToolbarButtonProc * const _toolbar_button_procs[] = {
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
989 ToolbarPauseClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
990 ToolbarFastForwardClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
991 ToolbarOptionsClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
992 ToolbarSaveClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
993 ToolbarMapClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
994 ToolbarTownClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
995 ToolbarSubsidiesClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
996 ToolbarStationsClick,
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
997 ToolbarFinancesClick,
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
998 ToolbarCompaniesClick,
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
999 ToolbarGraphsClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1000 ToolbarLeagueClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1001 ToolbarIndustryClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1002 ToolbarTrainClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1003 ToolbarRoadClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1004 ToolbarShipClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1005 ToolbarAirClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1006 ToolbarZoomInClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1007 ToolbarZoomOutClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1008 ToolbarBuildRailClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1009 ToolbarBuildRoadClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1010 ToolbarBuildWaterClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1011 ToolbarBuildAirClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1012 ToolbarForestClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1013 ToolbarMusicClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1014 ToolbarNewspaperClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1015 ToolbarHelpClick,
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
1016 ToolbarSwitchClick,
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1017 };
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1018
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1019 struct MainToolbarWindow : Window {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1020 MainToolbarWindow(const WindowDesc *desc) : Window(desc)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1021 {
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1022 this->SetWidgetDisabledState(TBN_PAUSE, _networking && !_network_server); // if not server, disable pause button
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1023 this->SetWidgetDisabledState(TBN_FASTFORWARD, _networking); // if networking, disable fast-forward button
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1024
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1025 CLRBITS(this->flags4, WF_WHITE_BORDER_MASK);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1026
9310
7db2be3373f2 (svn r13178) -Fix (r13173): the main toolbar didn't respect patch settings, it was always positioned on the right side
smatz <smatz@openttd.org>
parents: 9305
diff changeset
1027 this->FindWindowPlacementAndResize(desc);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1028 PositionMainToolbar(this);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1029 DoZoomInOutWindow(ZOOM_NONE, this);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1030 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1031
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1032 virtual void OnPaint()
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1033 {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1034 /* Draw brown-red toolbar bg. */
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1035 GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2);
9607
3d6213e95b9a (svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch <frosch@openttd.org>
parents: 9604
diff changeset
1036 GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB4, FILLRECT_CHECKER);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1037
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1038 /* If spectator, disable all construction buttons
11361
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11252
diff changeset
1039 * ie : Build road, rail, ships, airports and landscaping
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11252
diff changeset
1040 * Since enabled state is the default, just disable when needed */
10996
ce54bfd52120 (svn r15336) -Fix: do not use _current_company in the GUI as there are no guarantees that _current_company is the same as _local_company.
rubidium <rubidium@openttd.org>
parents: 10960
diff changeset
1041 this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, TBN_RAILS, TBN_ROADS, TBN_WATER, TBN_AIR, TBN_LANDSCAPE, WIDGET_LIST_END);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1042 /* disable company list drop downs, if there are no companies */
11973
e17a54c88806 (svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead
smatz <smatz@openttd.org>
parents: 11924
diff changeset
1043 this->SetWidgetsDisabledState(Company::GetNumItems() == TBN_PAUSE, TBN_STATIONS, TBN_FINANCES, TBN_TRAINS, TBN_ROADVEHS, TBN_SHIPS, TBN_AIRCRAFTS, WIDGET_LIST_END);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1044
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1045 this->SetWidgetDisabledState(TBN_RAILS, !CanBuildVehicleInfrastructure(VEH_TRAIN));
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1046 this->SetWidgetDisabledState(TBN_AIR, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT));
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1047
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1048 this->DrawWidgets();
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1049 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1050
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1051 virtual void OnClick(Point pt, int widget)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1052 {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1053 if (_game_mode != GM_MENU && !this->IsWidgetDisabled(widget)) _toolbar_button_procs[widget](this);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1054 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1055
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1056 virtual void OnDropdownSelect(int widget, int index)
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1057 {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1058 _menu_clicked_procs[widget](index);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1059 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1060
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1061 virtual EventState OnKeyPress(uint16 key, uint16 keycode)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1062 {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1063 switch (keycode) {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1064 case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(this); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1065 case WKC_F2: ShowGameOptions(); break;
9610
9fef7cbc9e5b (svn r13663) -Codechange: Use a default parameter, hoping to reduce the different signatures of functions in menus
belugas <belugas@openttd.org>
parents: 9607
diff changeset
1066 case WKC_F3: MenuClickSaveLoad(); break;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1067 case WKC_F4: ShowSmallMap(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1068 case WKC_F5: ShowTownDirectory(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1069 case WKC_F6: ShowSubsidiesList(); break;
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
1070 case WKC_F7: ShowCompanyStations(_local_company); break;
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
1071 case WKC_F8: ShowCompanyFinances(_local_company); break;
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
1072 case WKC_F9: ShowCompany(_local_company); break;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1073 case WKC_F10: ShowOperatingProfitGraph(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1074 case WKC_F11: ShowCompanyLeagueTable(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1075 case WKC_F12: ShowBuildIndustryWindow(); break;
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
1076 case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_company, VEH_TRAIN); break;
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
1077 case WKC_SHIFT | WKC_F2: ShowVehicleListWindow(_local_company, VEH_ROAD); break;
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
1078 case WKC_SHIFT | WKC_F3: ShowVehicleListWindow(_local_company, VEH_SHIP); break;
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10180
diff changeset
1079 case WKC_SHIFT | WKC_F4: ShowVehicleListWindow(_local_company, VEH_AIRCRAFT); break;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1080 case WKC_NUM_PLUS: // Fall through
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1081 case WKC_EQUALS: // Fall through
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1082 case WKC_SHIFT | WKC_EQUALS: // Fall through
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1083 case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(this); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1084 case WKC_NUM_MINUS: // Fall through
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1085 case WKC_MINUS: // Fall through
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1086 case WKC_SHIFT | WKC_MINUS: // Fall through
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1087 case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(this); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1088 case WKC_SHIFT | WKC_F7: if (CanBuildVehicleInfrastructure(VEH_TRAIN)) ShowBuildRailToolbar(_last_built_railtype, -1); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1089 case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(_last_built_roadtype); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1090 case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1091 case WKC_SHIFT | WKC_F10: if (CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) ShowBuildAirToolbar(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1092 case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1093 case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1094 case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1095 case WKC_CTRL | 'G': MenuClickWorldScreenshot(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1096 case WKC_CTRL | WKC_ALT | 'C': if (!_networking) ShowCheatWindow(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1097 case 'A': if (CanBuildVehicleInfrastructure(VEH_TRAIN)) ShowBuildRailToolbar(_last_built_railtype, 4); break; // Invoke Autorail
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1098 case 'L': ShowTerraformToolbar(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1099 case 'M': ShowSmallMap(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1100 case 'V': ShowExtraViewPortWindow(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1101 default: return ES_NOT_HANDLED;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1102 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1103 return ES_HANDLED;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1104 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1105
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1106 virtual void OnPlaceObject(Point pt, TileIndex tile)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1107 {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1108 _place_proc(tile);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1109 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1110
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1111 virtual void OnTick()
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1112 {
11852
862dd1024fe7 (svn r16242) -Codechange: rework pausing
rubidium <rubidium@openttd.org>
parents: 11730
diff changeset
1113 if (this->IsWidgetLowered(TBN_PAUSE) != !!_pause_mode) {
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1114 this->ToggleWidgetLoweredState(TBN_PAUSE);
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1115 this->InvalidateWidget(TBN_PAUSE);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1116 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1117
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1118 if (this->IsWidgetLowered(TBN_FASTFORWARD) != !!_fast_forward) {
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1119 this->ToggleWidgetLoweredState(TBN_FASTFORWARD);
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1120 this->InvalidateWidget(TBN_FASTFORWARD);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1121 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1122 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1123
11524
420a4f0b4e0b (svn r15885) -Codechange: Removed new_size parameter of Window::OnResize() callback
alberth <alberth@openttd.org>
parents: 11426
diff changeset
1124 virtual void OnResize(Point delta)
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1125 {
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1126 if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) {
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
1127 SplitToolbar(this);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1128 } else {
9425
af5b3b0809ee (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 <rubidium@openttd.org>
parents: 9354
diff changeset
1129 ResizeToolbar(this);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1130 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1131 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1132
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1133 virtual void OnTimeout()
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1134 {
9541
c01401030813 (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 <belugas@openttd.org>
parents: 9539
diff changeset
1135 for (uint i = TBN_SETTINGS; i < this->widget_count - 1; i++) {
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1136 if (this->IsWidgetLowered(i)) {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1137 this->RaiseWidget(i);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1138 this->InvalidateWidget(i);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1139 }
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1140 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1141 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1142
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1143 virtual void OnInvalidateData(int data)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1144 {
9539
3ae2b673ead5 (svn r13543) -Codechange: Enumification of the InGame toolbar and some leftovers of scenario editor one.
belugas <belugas@openttd.org>
parents: 9538
diff changeset
1145 if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBN_ZOOMIN, TBN_ZOOMOUT);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1146 }
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1147 };
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1148
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1149 static const Widget _toolb_normal_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1150 { WWT_IMGBTN, RESIZE_LEFT, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_PAUSE, STR_TOOLBAR_TOOLTIP_PAUSE_GAME}, // TBN_PAUSE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1151 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, // TBN_FASTFORWARD
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1152 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SETTINGS, STR_TOOLBAR_TOOLTIP_OPTIONS}, // TBN_SETTINGS
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1153 { WWT_IMGBTN_2, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SAVE, STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME}, // TBN_SAVEGAME
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1154
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1155 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SMALLMAP, STR_TOOLBAR_TOOLTIP_DISPLAY_MAP}, // TBN_SMALLMAP
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1156 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_TOWN, STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY}, // TBN_TOWNDIRECTORY
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1157 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SUBSIDIES, STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES}, // TBN_SUBSIDIES
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1158 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_COMPANY_LIST, STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS}, // TBN_STATIONS
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1159
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1160 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_COMPANY_FINANCE, STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES}, // TBN_FINANCES
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1161 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_COMPANY_GENERAL, STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL}, // TBN_COMPANIES
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1162 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_GRAPHS, STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS}, // TBN_GRAPHICS
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1163 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_COMPANY_LEAGUE, STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE}, // TBN_LEAGUE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1164 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_INDUSTRY, STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW}, // TBN_INDUSTRIES
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1165
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1166 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_TRAINLIST, STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS}, // TBN_TRAINS
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1167 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_TRUCKLIST, STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES}, // TBN_ROADVEHS
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1168 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SHIPLIST, STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS}, // TBN_SHIPS
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1169 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_AIRPLANESLIST, STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_AIRCRAFT}, // TBN_AIRCRAFTS
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1170
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1171 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN}, // TBN_ZOOMIN
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1172 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_ZOOMOUT, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_OUT}, // TBN_ZOOMOUT
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1173
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1174 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDRAIL, STR_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK}, // TBN_RAILS
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1175 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDROAD, STR_TOOLBAR_TOOLTIP_BUILD_ROADS}, // TBN_ROADS
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1176 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDWATER, STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS}, // TBN_WATER
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1177 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDAIR, STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS}, // TBN_AIR
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1178 { 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
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1179
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1180 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_MUSIC, STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW}, // TBN_MUSICSOUND
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1181 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_MESSAGES, STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS}, // TBN_NEWSREPORT
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1182 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_QUERY, STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION}, // TBN_HELP
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1183 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_SWITCH_TOOLBAR, STR_EMPTY}, // TBN_SWITCHBAR
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1184 { WIDGETS_END},
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1185 };
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1186
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1187 static const WindowDesc _toolb_normal_desc(
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1188 0, 0, 0, TBP_BUTTONHEIGHT, 640, TBP_BUTTONHEIGHT,
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1189 WC_MAIN_TOOLBAR, WC_NONE,
11081
0a26df8849a2 (svn r15424) -Codechange: make it possible to have multiple windows with edit box open simultaniously (Zuu).
rubidium <rubidium@openttd.org>
parents: 11069
diff changeset
1190 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_NO_FOCUS,
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1191 _toolb_normal_widgets
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1192 );
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1193
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1194
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
1195 /* --- Toolbar handling for the scenario editor */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
1196
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1197 static ToolbarButtonProc * const _scen_toolbar_button_procs[] = {
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1198 ToolbarPauseClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1199 ToolbarFastForwardClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1200 ToolbarOptionsClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1201 ToolbarScenSaveOrLoad,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1202 ToolbarBtn_NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1203 ToolbarBtn_NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1204 ToolbarScenDateBackward,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1205 ToolbarScenDateForward,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1206 ToolbarScenMapTownDir,
9614
93067a7ac4de (svn r13670) -Codechange : Merge some very alike events handlers.
belugas <belugas@openttd.org>
parents: 9610
diff changeset
1207 ToolbarZoomInClick,
93067a7ac4de (svn r13670) -Codechange : Merge some very alike events handlers.
belugas <belugas@openttd.org>
parents: 9610
diff changeset
1208 ToolbarZoomOutClick,
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1209 ToolbarScenGenLand,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1210 ToolbarScenGenTown,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1211 ToolbarScenGenIndustry,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1212 ToolbarScenBuildRoad,
9588
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
1213 ToolbarScenBuildDocks,
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1214 ToolbarScenPlantTrees,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1215 ToolbarScenPlaceSign,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1216 NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1217 NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1218 NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1219 NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1220 NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1221 NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1222 ToolbarMusicClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1223 NULL,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1224 ToolbarHelpClick,
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1225 };
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1226
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1227 struct ScenarioEditorToolbarWindow : Window {
9513
f4833946b217 (svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas <belugas@openttd.org>
parents: 9512
diff changeset
1228 public:
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1229 ScenarioEditorToolbarWindow(const WindowDesc *desc) : Window(desc)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1230 {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1231 CLRBITS(this->flags4, WF_WHITE_BORDER_MASK);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1232
9311
8020d9fb74e0 (svn r13179) -Fix (r13173): r13178 applies to the main toolbar in Scenario Editor, too
smatz <smatz@openttd.org>
parents: 9310
diff changeset
1233 this->FindWindowPlacementAndResize(desc);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1234 PositionMainToolbar(this);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1235 DoZoomInOutWindow(ZOOM_NONE, this);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1236 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1237
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1238 virtual void OnPaint()
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1239 {
11919
5a02b0ed51bc (svn r16321) -Fix (r5946): in the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios.
rubidium <rubidium@openttd.org>
parents: 11852
diff changeset
1240 this->SetWidgetDisabledState(TBSE_DATEBACKWARD, _settings_game.game_creation.starting_year <= MIN_YEAR);
5a02b0ed51bc (svn r16321) -Fix (r5946): in the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios.
rubidium <rubidium@openttd.org>
parents: 11852
diff changeset
1241 this->SetWidgetDisabledState(TBSE_DATEFORWARD, _settings_game.game_creation.starting_year >= MAX_YEAR);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1242
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1243 /* Draw brown-red toolbar bg. */
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1244 GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2);
9607
3d6213e95b9a (svn r13649) -Codechange: Split the GfxFillRect() special flags from 'color' into their own parameter.
frosch <frosch@openttd.org>
parents: 9604
diff changeset
1245 GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB4, FILLRECT_CHECKER);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1246
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1247 this->DrawWidgets();
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1248
11919
5a02b0ed51bc (svn r16321) -Fix (r5946): in the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios.
rubidium <rubidium@openttd.org>
parents: 11852
diff changeset
1249 SetDParam(0, ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1250 DrawString(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_DATE_LONG_WHITE, TC_FROMSTRING, SA_CENTER);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1251
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1252 /* We hide this panel when the toolbar space gets too small */
9513
f4833946b217 (svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas <belugas@openttd.org>
parents: 9512
diff changeset
1253 const Widget *panel = &this->widget[TBSE_SPACERPANEL];
f4833946b217 (svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas <belugas@openttd.org>
parents: 9512
diff changeset
1254 if (panel->left != panel->right) {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1255 DrawString(panel->left + 1, panel->right - 1, 1, STR_SCENEDIT_TOOLBAR_OPENTTD, TC_FROMSTRING, SA_CENTER);
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1256 DrawString(panel->left + 1, panel->right - 1, 11, STR_SCENEDIT_TOOLBAR_SCENARIO_EDITOR, TC_FROMSTRING, SA_CENTER);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1257 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1258 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1259
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1260 virtual void OnClick(Point pt, int widget)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1261 {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1262 if (_game_mode == GM_MENU) return;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1263 _scen_toolbar_button_procs[widget](this);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1264 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1265
10016
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1266 virtual void OnDropdownSelect(int widget, int index)
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1267 {
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1268 /* The map button is in a different location on the scenario
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1269 * editor toolbar, so we need to adjust for it. */
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1270 if (widget == TBSE_SMALLMAP) widget = TBN_SMALLMAP;
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1271 _menu_clicked_procs[widget](index);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1272 SndPlayFx(SND_15_BEEP);
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1273 }
b677c3c0c156 (svn r14175) -Codechange: Rewrite the main toolbars to use the standard dropdown menu system, allowing flexible menus instead of fixed string lists, and removing code duplication.
peter1138 <peter1138@openttd.org>
parents: 9827
diff changeset
1274
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1275 virtual EventState OnKeyPress(uint16 key, uint16 keycode)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1276 {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1277 switch (keycode) {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1278 case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(this); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1279 case WKC_F2: ShowGameOptions(); break;
9610
9fef7cbc9e5b (svn r13663) -Codechange: Use a default parameter, hoping to reduce the different signatures of functions in menus
belugas <belugas@openttd.org>
parents: 9607
diff changeset
1280 case WKC_F3: MenuClickSaveLoad(); break;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1281 case WKC_F4: ToolbarScenGenLand(this); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1282 case WKC_F5: ToolbarScenGenTown(this); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1283 case WKC_F6: ToolbarScenGenIndustry(this); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1284 case WKC_F7: ToolbarScenBuildRoad(this); break;
9588
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
1285 case WKC_F8: ToolbarScenBuildDocks(this); break;
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
1286 case WKC_F9: ToolbarScenPlantTrees(this); break;
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
1287 case WKC_F10: ToolbarScenPlaceSign(this); break;
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
1288 case WKC_F11: ShowMusicWindow(); break;
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
1289 case WKC_F12: PlaceLandBlockInfo(); break;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1290 case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1291 case WKC_CTRL | 'G': MenuClickWorldScreenshot(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1292
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1293 /* those following are all fall through */
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1294 case WKC_NUM_PLUS:
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1295 case WKC_EQUALS:
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1296 case WKC_SHIFT | WKC_EQUALS:
9614
93067a7ac4de (svn r13670) -Codechange : Merge some very alike events handlers.
belugas <belugas@openttd.org>
parents: 9610
diff changeset
1297 case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(this); break;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1298
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1299 /* those following are all fall through */
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1300 case WKC_NUM_MINUS:
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1301 case WKC_MINUS:
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1302 case WKC_SHIFT | WKC_MINUS:
9614
93067a7ac4de (svn r13670) -Codechange : Merge some very alike events handlers.
belugas <belugas@openttd.org>
parents: 9610
diff changeset
1303 case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(this); break;
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1304
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1305 case 'L': ShowEditorTerraformToolbar(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1306 case 'M': ShowSmallMap(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1307 case 'V': ShowExtraViewPortWindow(); break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1308 default: return ES_NOT_HANDLED;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1309 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1310 return ES_HANDLED;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1311 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1312
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1313 virtual void OnPlaceObject(Point pt, TileIndex tile)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1314 {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1315 _place_proc(tile);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1316 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1317
11524
420a4f0b4e0b (svn r15885) -Codechange: Removed new_size parameter of Window::OnResize() callback
alberth <alberth@openttd.org>
parents: 11426
diff changeset
1318 virtual void OnResize(Point delta)
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1319 {
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1320 /* There are 16 buttons plus some spacings if the space allows it.
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1321 * Furthermore there are two panels of which one is non - essential
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1322 * and that one can be removed if the space is too small. */
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1323 uint buttons_width;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1324 uint spacing;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1325
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1326 static const int normal_min_width = (TBP_SCENARIO_MAXBUTTON * TBP_BUTTONWIDTH) + (2 * TBP_DATEPANELWIDTH);
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1327 static const int one_less_panel_min_width = (TBP_SCENARIO_MAXBUTTON * TBP_BUTTONWIDTH) + TBP_DATEPANELWIDTH;
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1328
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1329 if (this->width >= one_less_panel_min_width) {
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1330 buttons_width = TBP_SCENARIO_MAXBUTTON * TBP_BUTTONWIDTH;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1331 spacing = this->width - ((this->width >= normal_min_width) ? normal_min_width : one_less_panel_min_width);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1332 } else {
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1333 buttons_width = this->width - TBP_DATEPANELWIDTH;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1334 spacing = 0;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1335 }
9588
06914318bfa5 (svn r13628) -Feature: enable building of aqueducts in the scenario editor
skidd13 <skidd13@openttd.org>
parents: 9571
diff changeset
1336 static const uint extra_spacing_at[] = { 3, 4, 7, 8, 10, 17, 0 };
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1337
9545
557d30df99a1 (svn r13560) -Fix(r13550): This section widget_count did not required to be lowered. So small revert
belugas <belugas@openttd.org>
parents: 9544
diff changeset
1338 for (uint i = 0, x = 0, j = 0, b = 0; i < this->widget_count; i++) {
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1339 switch (i) {
9546
c1c73fc1a29d (svn r13561) -Codechange: two more enumifications of widgets
belugas <belugas@openttd.org>
parents: 9545
diff changeset
1340 case TBSE_SPACERPANEL:
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1341 this->widget[i].left = x;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1342 if (this->width < normal_min_width) {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1343 this->widget[i].right = x;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1344 j++;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1345 continue;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1346 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1347
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1348 x += TBP_DATEPANELWIDTH;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1349 this->widget[i].right = x - 1;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1350 break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1351
9599
bfe46b72333f (svn r13641) -Fix: Misleading enum name.
belugas <belugas@openttd.org>
parents: 9588
diff changeset
1352 case TBSE_DATEPANEL: {
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1353 int offset = x - this->widget[i].left;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1354 this->widget[i + 1].left += offset;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1355 this->widget[i + 1].right += offset;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1356 this->widget[i + 2].left += offset;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1357 this->widget[i + 2].right += offset;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1358 this->widget[i].left = x;
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1359 x += TBP_DATEPANELWIDTH;
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1360 this->widget[i].right = x - 1;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1361 i += 2;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1362 } break;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1363
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1364 default:
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1365 if (this->widget[i].bottom == 0) continue;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1366
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1367 this->widget[i].left = x;
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1368 x += buttons_width / (TBP_SCENARIO_MAXBUTTON - b);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1369 this->widget[i].right = x - 1;
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1370 buttons_width -= buttons_width / (TBP_SCENARIO_MAXBUTTON - b);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1371 b++;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1372 break;
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1373 }
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1374
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1375 if (extra_spacing_at[j] == i) {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1376 j++;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1377 uint add = spacing / (lengthof(extra_spacing_at) - j);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1378 spacing -= add;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1379 x += add;
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1380 }
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1381 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1382 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1383
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1384 virtual void OnTick()
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1385 {
11852
862dd1024fe7 (svn r16242) -Codechange: rework pausing
rubidium <rubidium@openttd.org>
parents: 11730
diff changeset
1386 if (this->IsWidgetLowered(TBSE_PAUSE) != !!_pause_mode) {
9513
f4833946b217 (svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas <belugas@openttd.org>
parents: 9512
diff changeset
1387 this->ToggleWidgetLoweredState(TBSE_PAUSE);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1388 this->SetDirty();
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1389 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1390
9513
f4833946b217 (svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas <belugas@openttd.org>
parents: 9512
diff changeset
1391 if (this->IsWidgetLowered(TBSE_FASTFORWARD) != !!_fast_forward) {
f4833946b217 (svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas <belugas@openttd.org>
parents: 9512
diff changeset
1392 this->ToggleWidgetLoweredState(TBSE_FASTFORWARD);
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1393 this->SetDirty();
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1394 }
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1395 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1396
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1397 virtual void OnInvalidateData(int data)
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1398 {
9513
f4833946b217 (svn r13504) -Codechange: enumify some widgets for scenario editor. More work is required.
belugas <belugas@openttd.org>
parents: 9512
diff changeset
1399 if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBSE_ZOOMIN, TBSE_ZOOMOUT);
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1400 }
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1401 };
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1402
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1403 static const Widget _toolb_scen_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1404 { WWT_IMGBTN, RESIZE_LEFT, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_PAUSE, STR_TOOLBAR_TOOLTIP_PAUSE_GAME}, // TBSE_PAUSE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1405 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_FASTFORWARD, STR_FAST_FORWARD}, // TBSE_FASTFORWARD
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1406 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SETTINGS, STR_TOOLBAR_TOOLTIP_OPTIONS},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1407 {WWT_IMGBTN_2, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SAVE, STR_SCENEDIT_TOOLBAR_TOOLTIP_SAVE_SCENARIO_LOAD_SCENARIO}, // TBSE_SAVESCENARIO
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1408
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1409 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, 0x0, STR_NULL}, // TBSE_SPACERPANEL
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1410
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1411 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 129, 0, 21, 0x0, STR_NULL}, // TBSE_DATEPANEL
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1412 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 3, 14, 5, 16, SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD}, // TBSE_DATEBACKWARD
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1413 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 113, 125, 5, 16, SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD}, // TBSE_DATEFORWARD
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1414
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1415 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SMALLMAP, STR_TOOLBAR_TOOLTIP_DISPLAY_MAP_TOWN_DIRECTORY}, // TBSE_SMALLMAP
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1416
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1417 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN}, // TBSE_ZOOMIN
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1418 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_ZOOMOUT, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_OUT}, // TBSE_ZOOMOUT
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1419
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1420 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_LANDSCAPING, STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION}, // TBSE_LANDGENERATE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1421 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_TOWN, STR_SCENEDIT_TOOLBAR_TOWN_GENERATION}, // TBSE_TOWNGENERATE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1422 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_INDUSTRY, STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION}, // TBSE_INDUSTRYGENERATE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1423 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDROAD, STR_SCENEDIT_TOOLBAR_ROAD_CONSTRUCTION}, // TBSE_BUILDROAD
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1424 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_BUILDWATER, STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS}, // TBSE_BUILDDOCKS
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1425 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_PLANTTREES, STR_SCENEDIT_TOOLBAR_PLANT_TREES}, // TBSE_PLANTTREES
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1426 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_SIGN, STR_SCENEDIT_TOOLBAR_PLACE_SIGN}, // TBSE_PLACESIGNS
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1427
9778
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
1428 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL},
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
1429 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL},
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
1430 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL},
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
1431 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL},
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
1432 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL},
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
1433 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL},
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1434 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_MUSIC, STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW},
9778
aafe72af338c (svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas <belugas@openttd.org>
parents: 9659
diff changeset
1435 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL},
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1436 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 21, SPR_IMG_QUERY, STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION},
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1437 {WIDGETS_END},
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1438 };
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1439
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1440 static const WindowDesc _toolb_scen_desc(
9601
0da1efb33f71 (svn r13643) -Codechange: Enumify some loosely related values been used in the toolbar resizing processes
belugas <belugas@openttd.org>
parents: 9600
diff changeset
1441 0, 0, 130, TBP_BUTTONHEIGHT, 640, TBP_BUTTONHEIGHT,
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1442 WC_MAIN_TOOLBAR, WC_NONE,
11081
0a26df8849a2 (svn r15424) -Codechange: make it possible to have multiple windows with edit box open simultaniously (Zuu).
rubidium <rubidium@openttd.org>
parents: 11069
diff changeset
1443 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_NO_FOCUS,
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1444 _toolb_scen_widgets
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1445 );
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1446
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
1447 /* --- Allocating the toolbar --- */
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
1448
9240
5cedbfe95435 (svn r13106) -Codechange: rework the toolbar code a little so functions do not have to return the Window they just created.
rubidium <rubidium@openttd.org>
parents: 9195
diff changeset
1449 void AllocateToolbar()
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1450 {
9014
faed11573a2d (svn r12813) -Fix [FS#1943]: the 'last built railtype' got reset too often.
rubidium <rubidium@openttd.org>
parents: 8977
diff changeset
1451 /* Clean old GUI values; railtype is (re)set by rail_gui.cpp */
8975
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
1452 _last_built_roadtype = ROADTYPE_ROAD;
b053ca278abe (svn r12767) -Codechange: merge all main toolbar related functions into a single file instead of scattering the functionality over several files.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
1453
9305
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1454 if (_game_mode == GM_EDITOR) {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1455 new ScenarioEditorToolbarWindow(&_toolb_scen_desc);;
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1456 } else {
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1457 new MainToolbarWindow(&_toolb_normal_desc);
138a2ed3fd77 (svn r13173) -Codechange: make windows of the main toolbars.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1458 }
8723
36823c86c7f1 (svn r12398) -Codechange [FS#1770]: Move toolbar related code to it's own little neighbourhood. Based on a patch by Dominik.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1459 }