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