annotate src/company_gui.cpp @ 13247:fa47ce23bcfd draft

(svn r17756) -Codechange: Company finances window uses pure nested widgets.
author alberth <alberth@openttd.org>
date Sat, 10 Oct 2009 15:18:20 +0000
parents 507592717f3a
children ddfb6a69b9c3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
12778
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12632
diff changeset
3 /*
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12632
diff changeset
4 * This file is part of OpenTTD.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12632
diff changeset
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12632
diff changeset
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12632
diff changeset
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12632
diff changeset
8 */
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12632
diff changeset
9
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
10 /** @file company_gui.cpp Company related GUIs. */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
11
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
12 #include "stdafx.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
13 #include "gui.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
14 #include "window_gui.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
15 #include "textbuf_gui.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
16 #include "viewport_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
17 #include "gfx_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
18 #include "company_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
19 #include "command_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
20 #include "network/network.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
21 #include "network/network_gui.h"
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
22 #include "network/network_func.h"
13186
afdfdda87cd4 (svn r17693) -Cleanup: remove some unneeded includes
rubidium <rubidium@openttd.org>
parents: 13073
diff changeset
23 #include "sprite.h"
afdfdda87cd4 (svn r17693) -Cleanup: remove some unneeded includes
rubidium <rubidium@openttd.org>
parents: 13073
diff changeset
24 #include "economy_func.h"
afdfdda87cd4 (svn r17693) -Cleanup: remove some unneeded includes
rubidium <rubidium@openttd.org>
parents: 13073
diff changeset
25 #include "vehicle_base.h"
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
26 #include "newgrf.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
27 #include "company_manager_face.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
28 #include "strings_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
29 #include "date_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
30 #include "widgets/dropdown_type.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
31 #include "tilehighlight_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
32
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 #include "table/strings.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
34
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
35 /** Company GUI constants. */
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
36 enum {
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
37 FIRST_GUI_CALL = INT_MAX, ///< default value to specify this is the first call of the resizable gui
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
38
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
39 EXP_LINESPACE = 2, ///< Amount of vertical space for a horizontal (sub-)total line.
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
40 EXP_BLOCKSPACE = 10, ///< Amount of vertical space between two blocks of numbers.
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
41 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
42
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
43 static void DoSelectCompanyManagerFace(Window *parent, bool show_big, int top = FIRST_GUI_CALL, int left = FIRST_GUI_CALL);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
44
10962
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
45 /** Standard unsorted list of expenses. */
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
46 static ExpensesType _expenses_list_1[] = {
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
47 EXPENSES_CONSTRUCTION,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
48 EXPENSES_NEW_VEHICLES,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
49 EXPENSES_TRAIN_RUN,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
50 EXPENSES_ROADVEH_RUN,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
51 EXPENSES_AIRCRAFT_RUN,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
52 EXPENSES_SHIP_RUN,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
53 EXPENSES_PROPERTY,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
54 EXPENSES_TRAIN_INC,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
55 EXPENSES_ROADVEH_INC,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
56 EXPENSES_AIRCRAFT_INC,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
57 EXPENSES_SHIP_INC,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
58 EXPENSES_LOAN_INT,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
59 EXPENSES_OTHER,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
60 };
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
61
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
62 /** Grouped list of expenses. */
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
63 static ExpensesType _expenses_list_2[] = {
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
64 EXPENSES_TRAIN_INC,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
65 EXPENSES_ROADVEH_INC,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
66 EXPENSES_AIRCRAFT_INC,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
67 EXPENSES_SHIP_INC,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
68 INVALID_EXPENSES,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
69 EXPENSES_TRAIN_RUN,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
70 EXPENSES_ROADVEH_RUN,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
71 EXPENSES_AIRCRAFT_RUN,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
72 EXPENSES_SHIP_RUN,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
73 EXPENSES_PROPERTY,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
74 EXPENSES_LOAN_INT,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
75 INVALID_EXPENSES,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
76 EXPENSES_CONSTRUCTION,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
77 EXPENSES_NEW_VEHICLES,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
78 EXPENSES_OTHER,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
79 INVALID_EXPENSES,
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
80 };
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
81
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
82 /** Expense list container. */
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
83 struct ExpensesList {
13245
507592717f3a (svn r17754) -Codechange: Make ExpensesList::GetHeight() return a uint.
alberth <alberth@openttd.org>
parents: 13244
diff changeset
84 const ExpensesType *et; ///< Expenses items.
507592717f3a (svn r17754) -Codechange: Make ExpensesList::GetHeight() return a uint.
alberth <alberth@openttd.org>
parents: 13244
diff changeset
85 const uint length; ///< Number of items in list.
507592717f3a (svn r17754) -Codechange: Make ExpensesList::GetHeight() return a uint.
alberth <alberth@openttd.org>
parents: 13244
diff changeset
86 const uint num_subtotals; ///< Number of sub-totals in the list.
11897
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
87
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
88 ExpensesList(ExpensesType *et, int length, int num_subtotals) : et(et), length(length), num_subtotals(num_subtotals)
11897
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
89 {
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
90 }
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
91
13245
507592717f3a (svn r17754) -Codechange: Make ExpensesList::GetHeight() return a uint.
alberth <alberth@openttd.org>
parents: 13244
diff changeset
92 uint GetHeight() const
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
93 {
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
94 /* heading + line + texts of expenses + sub-totals + total line + total text */
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
95 return FONT_HEIGHT_NORMAL + EXP_LINESPACE + this->length * FONT_HEIGHT_NORMAL + num_subtotals * (EXP_BLOCKSPACE + EXP_LINESPACE) + EXP_LINESPACE + FONT_HEIGHT_NORMAL;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
96 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
97
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
98 /** Compute width of the expenses categories in pixels. */
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
99 uint GetCategoriesWidth() const
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
100 {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
101 uint width = 0;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
102 bool invalid_expenses_measured = false; // Measure 'Total' width only once.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
103 for (uint i = 0; i < this->length; i++) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
104 ExpensesType et = this->et[i];
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
105 if (et == INVALID_EXPENSES) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
106 if (!invalid_expenses_measured) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
107 width = max(width, GetStringBoundingBox(STR_FINANCES_TOTAL_CAPTION).width);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
108 invalid_expenses_measured = true;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
109 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
110 } else {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
111 width = max(width, GetStringBoundingBox(STR_FINANCES_SECTION_CONSTRUCTION + et).width);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
112 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
113 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
114 return width;
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
115 }
10962
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
116 };
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
117
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
118 static const ExpensesList _expenses_list_types[] = {
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
119 ExpensesList(_expenses_list_1, lengthof(_expenses_list_1), 0),
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
120 ExpensesList(_expenses_list_2, lengthof(_expenses_list_2), 3),
10962
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
121 };
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
122
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
123 /** Widgets of the company finances windows. */
11503
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
124 enum CompanyFinancesWindowWidgets {
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
125 CFW_CLOSEBOX = 0, ///< Close the window
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
126 CFW_CAPTION, ///< Caption of the window
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
127 CFW_TOGGLE_SIZE, ///< Toggle windows size
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
128 CFW_STICKY, ///< Sticky button
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
129 CFW_EXPS_PANEL, ///< Panel for expenses
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
130 CFW_SEL_PANEL, ///< Select panel or nothing
11503
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
131 CFW_EXPS_CATEGORY, ///< Column for expenses category strings
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
132 CFW_EXPS_PRICE1, ///< Column for year Y-2 expenses
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
133 CFW_EXPS_PRICE2, ///< Column for year Y-1 expenses
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
134 CFW_EXPS_PRICE3, ///< Column for year Y expenses
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
135 CFW_TOTAL_PANEL, ///< Panel for totals
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
136 CFW_SEL_MAXLOAN, ///< Selection of maxloan column
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
137 CFW_BALANCE_TITLE, ///< 'Bank balance' title
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
138 CFW_LOAN_TITLE, ///< 'Loan' title
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
139 CFW_BALANCE_VALUE, ///< Bank balance value
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
140 CFW_LOAN_VALUE, ///< Loan
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
141 CFW_LOAN_LINE, ///< Line for summing bank balance and loan
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
142 CFW_TOTAL_VALUE, ///< Total
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
143 CFW_MAXLOAN_GAP, ///< Gap above max loan widget
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
144 CFW_MAXLOAN_VALUE, ///< Max loan widget
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
145 CFW_SEL_BUTTONS, ///< Selection of buttons
11503
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
146 CFW_INCREASE_LOAN, ///< Increase loan
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
147 CFW_REPAY_LOAN, ///< Decrease loan
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
148 };
9272c49b41d7 (svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents: 11494
diff changeset
149
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
150 /** Draw the expenses categories.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
151 * @param r Available space for drawing.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
152 * @note The environment must provide padding at the left and right of \a r.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
153 */
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
154 static void DrawCategories(const Rect &r)
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
155 {
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
156 int y = r.top;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
157
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
158 DrawString(r.left, r.right, y, STR_FINANCES_EXPENDITURE_INCOME_TITLE, TC_FROMSTRING, SA_CENTER, true);
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
159 y += FONT_HEIGHT_NORMAL + EXP_LINESPACE;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
160
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
161 int type = _settings_client.gui.expenses_layout;
13245
507592717f3a (svn r17754) -Codechange: Make ExpensesList::GetHeight() return a uint.
alberth <alberth@openttd.org>
parents: 13244
diff changeset
162 for (uint i = 0; i < _expenses_list_types[type].length; i++) {
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
163 const ExpensesType et = _expenses_list_types[type].et[i];
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
164 if (et == INVALID_EXPENSES) {
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
165 y += EXP_LINESPACE;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
166 DrawString(r.left, r.right, y, STR_FINANCES_TOTAL_CAPTION, TC_FROMSTRING, SA_RIGHT);
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
167 y += FONT_HEIGHT_NORMAL + EXP_BLOCKSPACE;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
168 } else {
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
169 DrawString(r.left, r.right, y, STR_FINANCES_SECTION_CONSTRUCTION + et);
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
170 y += FONT_HEIGHT_NORMAL;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
171 }
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
172 }
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
173
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
174 DrawString(r.left, r.right, y + EXP_LINESPACE, STR_FINANCES_TOTAL_CAPTION, TC_FROMSTRING, SA_RIGHT);
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
175 }
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
176
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
177 /** Draw an amount of money.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
178 * @param amount Amount of money to draw,
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
179 * @param left Left coordinate of the space to draw in.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
180 * @param right Right coordinate of the space to draw in.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
181 * @param top Top coordinate of the space to draw in.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
182 */
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
183 static void DrawPrice(Money amount, int left, int right, int top)
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
184 {
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
185 StringID str = STR_FINANCES_NEGATIVE_INCOME;
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
186 if (amount < 0) {
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
187 amount = -amount;
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
188 str++;
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
189 }
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
190 SetDParam(0, amount);
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
191 DrawString(left, right, top, str, TC_FROMSTRING, SA_RIGHT);
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
192 }
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
193
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
194 /** Draw a column with prices.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
195 * @param r Available space for drawing.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
196 * @param year Year being drawn.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
197 * @param tbl Pointer to table of amounts for \a year.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
198 * @note The environment must provide padding at the left and right of \a r.
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
199 */
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
200 static void DrawYearColumn(const Rect &r, int year, const Money (*tbl)[EXPENSES_END])
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
201 {
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
202 int y = r.top;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
203
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
204 SetDParam(0, year);
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
205 DrawString(r.left, r.right, y, STR_FINANCES_YEAR, TC_FROMSTRING, SA_RIGHT, true);
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
206 y += FONT_HEIGHT_NORMAL + EXP_LINESPACE;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
207
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
208 Money sum = 0;
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
209 Money subtotal = 0;
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
210 int type = _settings_client.gui.expenses_layout;
13245
507592717f3a (svn r17754) -Codechange: Make ExpensesList::GetHeight() return a uint.
alberth <alberth@openttd.org>
parents: 13244
diff changeset
211 for (uint i = 0; i < _expenses_list_types[type].length; i++) {
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
212 const ExpensesType et = _expenses_list_types[type].et[i];
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
213 if (et == INVALID_EXPENSES) {
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
214 Money cost = subtotal;
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
215 subtotal = 0;
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
216 GfxFillRect(r.left, y, r.right, y, 215);
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
217 y += EXP_LINESPACE;
13244
ef86ddf0e0a9 (svn r17753) -Fix (r17750): Expenses amounts were printed two pixels too low.
alberth <alberth@openttd.org>
parents: 13241
diff changeset
218 DrawPrice(cost, r.left, r.right, y);
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
219 y += FONT_HEIGHT_NORMAL + EXP_BLOCKSPACE;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
220 } else {
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
221 Money cost = (*tbl)[et];
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
222 subtotal += cost;
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
223 sum += cost;
13244
ef86ddf0e0a9 (svn r17753) -Fix (r17750): Expenses amounts were printed two pixels too low.
alberth <alberth@openttd.org>
parents: 13241
diff changeset
224 if (cost != 0) DrawPrice(cost, r.left, r.right, y);
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
225 y += FONT_HEIGHT_NORMAL;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
226 }
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
227 }
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
228
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
229 GfxFillRect(r.left, y, r.right, y, 215);
13241
d2c79a7bd44f (svn r17750) -Codechange: Financial expenses panel handles different font size, replaced magic numbers by constants.
alberth <alberth@openttd.org>
parents: 13233
diff changeset
230 y += EXP_LINESPACE;
13233
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
231 DrawPrice(sum, r.left, r.right, y);
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
232 }
6aea0f7436aa (svn r17740) -Codechange: Extract financial expenses drawing routines.
alberth <alberth@openttd.org>
parents: 13217
diff changeset
233
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
234 static const NWidgetPart _nested_company_finances_widgets[] = {
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
235 NWidget(NWID_HORIZONTAL),
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
236 NWidget(WWT_CLOSEBOX, COLOUR_GREY, CFW_CLOSEBOX), SetFill(false, true),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
237 NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetDataTip(STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
238 NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetMinimalSize(14, 14), SetFill(false, true), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
239 NWidget(WWT_STICKYBOX, COLOUR_GREY, CFW_STICKY), SetFill(false, true),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
240 EndContainer(),
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
241 NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_PANEL),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
242 NWidget(WWT_PANEL, COLOUR_GREY, CFW_EXPS_PANEL),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
243 NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
244 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_CATEGORY), SetMinimalSize(120, 0), SetFill(false, false),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
245 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE1), SetMinimalSize(86, 0), SetFill(false, false),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
246 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE2), SetMinimalSize(86, 0), SetFill(false, false),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
247 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE3), SetMinimalSize(86, 0), SetFill(false, false),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
248 EndContainer(),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
249 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
250 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
251 NWidget(WWT_PANEL, COLOUR_GREY, CFW_TOTAL_PANEL),
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
252 NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
253 NWidget(NWID_VERTICAL), // Vertical column with 'bank balance', 'loan'
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
254 NWidget(WWT_TEXT, COLOUR_GREY, CFW_BALANCE_TITLE), SetDataTip(STR_FINANCES_BANK_BALANCE_TITLE, STR_NULL), SetFill(true, false),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
255 NWidget(WWT_TEXT, COLOUR_GREY, CFW_LOAN_TITLE), SetDataTip(STR_FINANCES_LOAN_TITLE, STR_NULL), SetFill(true, false),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
256 NWidget(NWID_SPACER), SetFill(false, true),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
257 EndContainer(),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
258 NWidget(NWID_SPACER), SetFill(false, false), SetMinimalSize(30, 0),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
259 NWidget(NWID_VERTICAL), // Vertical column with bank balance amount, loan amount, and total.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
260 NWidget(WWT_TEXT, COLOUR_GREY, CFW_BALANCE_VALUE), SetDataTip(STR_NULL, STR_NULL),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
261 NWidget(WWT_TEXT, COLOUR_GREY, CFW_LOAN_VALUE), SetDataTip(STR_NULL, STR_NULL),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
262 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_LOAN_LINE), SetMinimalSize(0, 2), SetFill(true, false),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
263 NWidget(WWT_TEXT, COLOUR_GREY, CFW_TOTAL_VALUE), SetDataTip(STR_NULL, STR_NULL),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
264 EndContainer(),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
265 NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_MAXLOAN),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
266 NWidget(NWID_HORIZONTAL),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
267 NWidget(NWID_SPACER), SetFill(false, true), SetMinimalSize(25, 0),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
268 NWidget(NWID_VERTICAL), // Max loan information
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
269 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_MAXLOAN_GAP), SetFill(false, false),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
270 NWidget(WWT_TEXT, COLOUR_GREY, CFW_MAXLOAN_VALUE), SetDataTip(STR_FINANCES_MAX_LOAN, STR_NULL),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
271 NWidget(NWID_SPACER), SetFill(false, true),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
272 EndContainer(),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
273 EndContainer(),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
274 EndContainer(),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
275 NWidget(NWID_SPACER), SetFill(true, true),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
276 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
277 EndContainer(),
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
278 NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_BUTTONS),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
279 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
280 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INCREASE_LOAN), SetFill(true, false), SetDataTip(STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_TOOLTIP),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
281 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_REPAY_LOAN), SetFill(true, false), SetDataTip(STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP),
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
282 EndContainer(),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
283 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
284 };
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
285
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
286 /** Window class displaying the company finances.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
287 * @todo #money_width should be calculated dynamically.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
288 */
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
289 struct CompanyFinancesWindow : Window {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
290 bool small; ///< Window is toggled to 'small'.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
291 uint money_width; ///< Width needed for displaying all amounts.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
292
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
293 CompanyFinancesWindow(const WindowDesc *desc, CompanyID company) : Window()
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
294 {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
295 this->small = false;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
296 this->money_width = 86;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
297 this->CreateNestedTree(desc);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
298 this->SetupWidgets();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
299 this->FinishInitNested(desc, company);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
300
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
301 this->owner = (Owner)this->window_number;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
302 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
303
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
304 virtual void SetStringParameters(int widget) const
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
305 {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
306 const Company *c = Company::Get((CompanyID)this->window_number);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
307 switch (widget) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
308 case CFW_CAPTION:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
309 SetDParam(0, c->index);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
310 SetDParam(1, c->index);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
311 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
312
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
313 case CFW_MAXLOAN_VALUE:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
314 SetDParam(0, _economy.max_loan);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
315 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
316
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
317 case CFW_INCREASE_LOAN:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
318 case CFW_REPAY_LOAN:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
319 SetDParam(2, LOAN_INTERVAL);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
320 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
321 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
322 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
323
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
324 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
325 {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
326 int type = _settings_client.gui.expenses_layout;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
327 switch (widget) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
328 case CFW_EXPS_CATEGORY:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
329 size->width = _expenses_list_types[type].GetCategoriesWidth();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
330 size->height = _expenses_list_types[type].GetHeight();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
331 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
332
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
333 case CFW_EXPS_PRICE1:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
334 case CFW_EXPS_PRICE2:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
335 case CFW_EXPS_PRICE3:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
336 size->width = this->money_width;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
337 size->height = _expenses_list_types[type].GetHeight();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
338 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
339
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
340 case CFW_BALANCE_VALUE:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
341 case CFW_LOAN_VALUE:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
342 case CFW_TOTAL_VALUE:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
343 size->width = this->money_width + padding.width;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
344 break;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
345
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
346 case CFW_MAXLOAN_GAP:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
347 size->height = FONT_HEIGHT_NORMAL;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
348 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
349 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
350 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
351
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
352 virtual void DrawWidget(const Rect &r, int widget) const
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
353 {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
354 switch (widget) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
355 case CFW_EXPS_CATEGORY:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
356 DrawCategories(r);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
357 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
358
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
359 case CFW_EXPS_PRICE1:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
360 case CFW_EXPS_PRICE2:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
361 case CFW_EXPS_PRICE3: {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
362 const Company *c = Company::Get((CompanyID)this->window_number);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
363 int age = min(_cur_year - c->inaugurated_year, 2);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
364 int wid_offset = widget - CFW_EXPS_PRICE1;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
365 if (wid_offset <= age) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
366 DrawYearColumn(r, _cur_year - (age - wid_offset), c->yearly_expenses + (age - wid_offset));
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
367 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
368 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
369 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
370
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
371 case CFW_BALANCE_VALUE: {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
372 const Company *c = Company::Get((CompanyID)this->window_number);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
373 SetDParam(0, c->money);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
374 DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
375 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
376 }
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
377
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
378 case CFW_LOAN_VALUE: {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
379 const Company *c = Company::Get((CompanyID)this->window_number);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
380 SetDParam(0, c->current_loan);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
381 DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
382 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
383 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
384
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
385 case CFW_TOTAL_VALUE: {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
386 const Company *c = Company::Get((CompanyID)this->window_number);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
387 SetDParam(0, c->money - c->current_loan);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
388 DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
389 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
390 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
391
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
392 case CFW_LOAN_LINE:
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
393 GfxFillRect(r.left, r.top, r.right, r.top, 215);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
394 break;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
395 }
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
396 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
397
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
398 /** Setup the widgets in the nested tree, such that the finances window is displayed properly.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
399 * @note After setup, the window must be (re-)initialized.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
400 */
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
401 void SetupWidgets()
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
402 {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
403 int plane = small ? STACKED_SELECTION_ZERO_SIZE : 0;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
404 this->GetWidget<NWidgetStacked>(CFW_SEL_PANEL)->SetDisplayedPlane(plane);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
405 this->GetWidget<NWidgetStacked>(CFW_SEL_MAXLOAN)->SetDisplayedPlane(plane);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
406
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
407 CompanyID company = (CompanyID)this->window_number;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
408 plane = (company != _local_company) ? STACKED_SELECTION_ZERO_SIZE : 0;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
409 this->GetWidget<NWidgetStacked>(CFW_SEL_BUTTONS)->SetDisplayedPlane(plane);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
410 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
411
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
412 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
413 {
10962
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
414 if (!small) {
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
415 /* Check that the expenses panel height matches the height needed for the layout. */
10962
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
416 int type = _settings_client.gui.expenses_layout;
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
417 if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetCore>(CFW_EXPS_CATEGORY)->current_y) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
418 this->SetupWidgets();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
419 this->ReInit();
10962
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
420 return;
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
421 }
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
422 }
bcb22b063237 (svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents: 10960
diff changeset
423
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
424 /* Check that the loan buttons are shown only when the user owns the company. */
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
425 CompanyID company = (CompanyID)this->window_number;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
426 int req_plane = (company != _local_company) ? STACKED_SELECTION_ZERO_SIZE : 0;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
427 if (req_plane != this->GetWidget<NWidgetStacked>(CFW_SEL_BUTTONS)->shown_plane) {
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
428 this->SetupWidgets();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
429 this->ReInit();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
430 return;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
431 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
432
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
433 const Company *c = Company::Get(company);
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
434 this->SetWidgetDisabledState(CFW_INCREASE_LOAN, c->current_loan == _economy.max_loan); // Borrow button only shows when there is any more money to loan.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
435 this->SetWidgetDisabledState(CFW_REPAY_LOAN, company != _local_company || c->current_loan == 0); // Repay button only shows when there is any more money to repay.
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
436
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
437 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
438 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
439
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
440 virtual void OnClick(Point pt, int widget)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
441 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
442 switch (widget) {
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
443 case CFW_TOGGLE_SIZE: // toggle size
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
444 this->small = !this->small;
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
445 this->SetupWidgets();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
446 this->ReInit();
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
447 break;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
448
11494
6af9e6523c41 (svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents: 11450
diff changeset
449 case CFW_INCREASE_LOAN: // increase loan
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
450 DoCommandP(0, 0, _ctrl_pressed, CMD_INCREASE_LOAN | CMD_MSG(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY));
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
451 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
452
11494
6af9e6523c41 (svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents: 11450
diff changeset
453 case CFW_REPAY_LOAN: // repay loan
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
454 DoCommandP(0, 0, _ctrl_pressed, CMD_DECREASE_LOAN | CMD_MSG(STR_ERROR_CAN_T_REPAY_LOAN));
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
455 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
456 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
457 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
458 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
459
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
460 static const WindowDesc _company_finances_desc(
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
461 WDP_AUTO, WDP_AUTO, 0, 0, 0, 0,
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
462 WC_FINANCES, WC_NONE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
463 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
464 NULL, _nested_company_finances_widgets, lengthof(_nested_company_finances_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
465 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
466
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
467 /** Open the finances window of a company.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
468 * @param company Company to show finances of.
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
469 * @pre is company a valid company.
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
470 */
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
471 void ShowCompanyFinances(CompanyID company)
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
472 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
473 if (!Company::IsValidID(company)) return;
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
474 if (BringWindowToFrontById(WC_FINANCES, company)) return;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
475
13247
fa47ce23bcfd (svn r17756) -Codechange: Company finances window uses pure nested widgets.
alberth <alberth@openttd.org>
parents: 13245
diff changeset
476 new CompanyFinancesWindow(&_company_finances_desc, company);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
477 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
478
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
479 /* List of colours for the livery window */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
480 static const StringID _colour_dropdown[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
481 STR_COLOUR_DARK_BLUE,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
482 STR_COLOUR_PALE_GREEN,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
483 STR_COLOUR_PINK,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
484 STR_COLOUR_YELLOW,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
485 STR_COLOUR_RED,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
486 STR_COLOUR_LIGHT_BLUE,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
487 STR_COLOUR_GREEN,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
488 STR_COLOUR_DARK_GREEN,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
489 STR_COLOUR_BLUE,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
490 STR_COLOUR_CREAM,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
491 STR_COLOUR_MAUVE,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
492 STR_COLOUR_PURPLE,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
493 STR_COLOUR_ORANGE,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
494 STR_COLOUR_BROWN,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
495 STR_COLOUR_GREY,
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
496 STR_COLOUR_WHITE,
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
497 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
498
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
499 /* Association of liveries to livery classes */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
500 static const LiveryClass _livery_class[LS_END] = {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
501 LC_OTHER,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
502 LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
503 LC_ROAD, LC_ROAD,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
504 LC_SHIP, LC_SHIP,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
505 LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
506 LC_ROAD, LC_ROAD,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
507 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
508
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
509 class DropDownListColourItem : public DropDownListItem {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
510 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
511 DropDownListColourItem(int result, bool masked) : DropDownListItem(result, masked) {}
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
512
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
513 virtual ~DropDownListColourItem() {}
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
514
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
515 StringID String() const
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
516 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
517 return _colour_dropdown[this->result];
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
518 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
519
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
520 uint Height(uint width) const
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
521 {
11516
8e9dee9357f7 (svn r15877) -Codechange: Let drop down lists know about font height.
peter1138 <peter1138@openttd.org>
parents: 11508
diff changeset
522 return max(FONT_HEIGHT_NORMAL, (byte)14);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
523 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
524
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
525 bool Selectable() const
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
526 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
527 return true;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
528 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
529
11425
532a1c74074d (svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents: 11373
diff changeset
530 void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
531 {
11425
532a1c74074d (svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents: 11373
diff changeset
532 DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + this->result, left + 16, top + 7);
11516
8e9dee9357f7 (svn r15877) -Codechange: Let drop down lists know about font height.
peter1138 <peter1138@openttd.org>
parents: 11508
diff changeset
533 DrawString(left + 32, right - 2, top + max(0, 13 - FONT_HEIGHT_NORMAL), this->String(), sel ? TC_WHITE : TC_BLACK);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
534 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
535 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
536
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
537 /** Widgets of the select company livery window. */
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
538 enum SelectCompanyLiveryWindowWidgets {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
539 SCLW_WIDGET_CLOSE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
540 SCLW_WIDGET_CAPTION,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
541 SCLW_WIDGET_CLASS_GENERAL,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
542 SCLW_WIDGET_CLASS_RAIL,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
543 SCLW_WIDGET_CLASS_ROAD,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
544 SCLW_WIDGET_CLASS_SHIP,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
545 SCLW_WIDGET_CLASS_AIRCRAFT,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
546 SCLW_WIDGET_SPACER_CLASS,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
547 SCLW_WIDGET_SPACER_DROPDOWN,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
548 SCLW_WIDGET_PRI_COL_DROPDOWN,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
549 SCLW_WIDGET_SEC_COL_DROPDOWN,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
550 SCLW_WIDGET_MATRIX,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
551 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
552
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
553 struct SelectCompanyLiveryWindow : public Window {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
554 private:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
555 uint32 sel;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
556 LiveryClass livery_class;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
557
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
558 void ShowColourDropDownMenu(uint32 widget)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
559 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
560 uint32 used_colours = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
561 const Livery *livery;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
562 LiveryScheme scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
563
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
564 /* Disallow other company colours for the primary colour */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
565 if (HasBit(this->sel, LS_DEFAULT) && widget == SCLW_WIDGET_PRI_COL_DROPDOWN) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
566 const Company *c;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
567 FOR_ALL_COMPANIES(c) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
568 if (c->index != _local_company) SetBit(used_colours, c->colour);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
569 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
570 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
571
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
572 /* Get the first selected livery to use as the default dropdown item */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
573 for (scheme = LS_BEGIN; scheme < LS_END; scheme++) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
574 if (HasBit(this->sel, scheme)) break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
575 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
576 if (scheme == LS_END) scheme = LS_DEFAULT;
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
577 livery = &Company::Get((CompanyID)this->window_number)->livery[scheme];
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
578
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
579 DropDownList *list = new DropDownList();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
580 for (uint i = 0; i < lengthof(_colour_dropdown); i++) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
581 list->push_back(new DropDownListColourItem(i, HasBit(used_colours, i)));
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
582 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
583
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
584 ShowDropDownList(this, list, widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? livery->colour1 : livery->colour2, widget);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
585 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
586
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
587 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
588 SelectCompanyLiveryWindow(const WindowDesc *desc, CompanyID company) : Window(desc, company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
589 {
11084
e07c7d3925c8 (svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents: 10998
diff changeset
590 this->owner = company;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
591 this->livery_class = LC_OTHER;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
592 this->sel = 1;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
593 this->LowerWidget(SCLW_WIDGET_CLASS_GENERAL);
12380
4be044af31ec (svn r16809) -Fix [FS#3021](r13096): automatic resizing of SelectCompanyLiveryWindow wasn't working as expected
smatz <smatz@openttd.org>
parents: 12299
diff changeset
594 this->OnInvalidateData();
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
595 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
596 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
597
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
598 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
599 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
600 const Company *c = Company::Get((CompanyID)this->window_number);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
601 LiveryScheme scheme = LS_DEFAULT;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
602 int y = 51;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
603
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
604 /* Disable dropdown controls if no scheme is selected */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
605 this->SetWidgetDisabledState(SCLW_WIDGET_PRI_COL_DROPDOWN, this->sel == 0);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
606 this->SetWidgetDisabledState(SCLW_WIDGET_SEC_COL_DROPDOWN, this->sel == 0);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
607
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
608 if (this->sel != 0) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
609 for (scheme = LS_BEGIN; scheme < LS_END; scheme++) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
610 if (HasBit(this->sel, scheme)) break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
611 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
612 if (scheme == LS_END) scheme = LS_DEFAULT;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
613 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
614
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
615 SetDParam(0, STR_COLOUR_DARK_BLUE + c->livery[scheme].colour1);
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
616 SetDParam(1, STR_COLOUR_DARK_BLUE + c->livery[scheme].colour2);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
617
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
618 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
619
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
620 for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
621 if (_livery_class[scheme] == this->livery_class) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
622 bool sel = HasBit(this->sel, scheme) != 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
623
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
624 if (scheme != LS_DEFAULT) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
625 DrawSprite(c->livery[scheme].in_use ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, 2, y);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
626 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
627
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
628 DrawString(15, 165, y, STR_LIVERY_DEFAULT + scheme, sel ? TC_WHITE : TC_BLACK);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
629
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
630 DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(c->livery[scheme].colour1), 152, y);
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
631 DrawString(165, 290, y, STR_COLOUR_DARK_BLUE + c->livery[scheme].colour1, sel ? TC_WHITE : TC_GOLD);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
632
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
633 if (!this->IsWidgetHidden(SCLW_WIDGET_SEC_COL_DROPDOWN)) {
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
634 DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(c->livery[scheme].colour2), 277, y);
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
635 DrawString(290, this->width, y, STR_COLOUR_DARK_BLUE + c->livery[scheme].colour2, sel ? TC_WHITE : TC_GOLD);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
636 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
637
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
638 y += 14;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
639 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
640 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
641 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
642
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
643 virtual void OnClick(Point pt, int widget)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
644 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
645 /* Number of liveries in each class, used to determine the height of the livery window */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
646 static const byte livery_height[] = {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
647 1,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
648 13,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
649 4,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
650 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
651 3,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
652 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
653
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
654 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
655 /* Livery Class buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
656 case SCLW_WIDGET_CLASS_GENERAL:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
657 case SCLW_WIDGET_CLASS_RAIL:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
658 case SCLW_WIDGET_CLASS_ROAD:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
659 case SCLW_WIDGET_CLASS_SHIP:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
660 case SCLW_WIDGET_CLASS_AIRCRAFT: {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
661 LiveryScheme scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
662
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
663 this->RaiseWidget(this->livery_class + SCLW_WIDGET_CLASS_GENERAL);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
664 this->livery_class = (LiveryClass)(widget - SCLW_WIDGET_CLASS_GENERAL);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
665 this->sel = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
666 this->LowerWidget(this->livery_class + SCLW_WIDGET_CLASS_GENERAL);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
667
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
668 /* Select the first item in the list */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
669 for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
670 if (_livery_class[scheme] == this->livery_class) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
671 this->sel = 1 << scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
672 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
673 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
674 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
675 this->height = 49 + livery_height[this->livery_class] * 14;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
676 this->widget[SCLW_WIDGET_MATRIX].bottom = this->height - 1;
12411
9fdbb4594b82 (svn r16845) -Codechange: Introduction of constants for describing the bits in a WWT_MATRIX data field.
alberth <alberth@openttd.org>
parents: 12380
diff changeset
677 this->widget[SCLW_WIDGET_MATRIX].data = (livery_height[this->livery_class] << MAT_ROW_START) | (1 << MAT_COL_START);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
678 MarkWholeScreenDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
679 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
680 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
681
11368
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
682 case SCLW_WIDGET_PRI_COL_DROPDOWN: // First colour dropdown
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
683 ShowColourDropDownMenu(SCLW_WIDGET_PRI_COL_DROPDOWN);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
684 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
685
11368
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
686 case SCLW_WIDGET_SEC_COL_DROPDOWN: // Second colour dropdown
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
687 ShowColourDropDownMenu(SCLW_WIDGET_SEC_COL_DROPDOWN);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
688 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
689
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
690 case SCLW_WIDGET_MATRIX: {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
691 LiveryScheme scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
692 LiveryScheme j = (LiveryScheme)((pt.y - 48) / 14);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
693
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
694 for (scheme = LS_BEGIN; scheme <= j; scheme++) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
695 if (_livery_class[scheme] != this->livery_class) j++;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
696 if (scheme >= LS_END) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
697 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
698 if (j >= LS_END) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
699
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
700 /* If clicking on the left edge, toggle using the livery */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
701 if (pt.x < 10) {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
702 DoCommandP(0, j | (2 << 8), !Company::Get((CompanyID)this->window_number)->livery[j].in_use, CMD_SET_COMPANY_COLOUR);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
703 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
704
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
705 if (_ctrl_pressed) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
706 ToggleBit(this->sel, j);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
707 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
708 this->sel = 1 << j;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
709 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
710 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
711 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
712 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
713 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
714 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
715
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
716 virtual void OnDropdownSelect(int widget, int index)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
717 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
718 for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
719 if (HasBit(this->sel, scheme)) {
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
720 DoCommandP(0, scheme | (widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOUR);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
721 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
722 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
723 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
724
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
725 virtual void OnInvalidateData(int data = 0)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
726 {
12380
4be044af31ec (svn r16809) -Fix [FS#3021](r13096): automatic resizing of SelectCompanyLiveryWindow wasn't working as expected
smatz <smatz@openttd.org>
parents: 12299
diff changeset
727 int r = this->widget[_loaded_newgrf_features.has_2CC ? SCLW_WIDGET_SEC_COL_DROPDOWN : SCLW_WIDGET_PRI_COL_DROPDOWN].right;
4be044af31ec (svn r16809) -Fix [FS#3021](r13096): automatic resizing of SelectCompanyLiveryWindow wasn't working as expected
smatz <smatz@openttd.org>
parents: 12299
diff changeset
728 this->SetWidgetHiddenState(SCLW_WIDGET_SEC_COL_DROPDOWN, !_loaded_newgrf_features.has_2CC);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
729 this->widget[SCLW_WIDGET_CAPTION].right = r;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
730 this->widget[SCLW_WIDGET_SPACER_CLASS].right = r;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
731 this->widget[SCLW_WIDGET_MATRIX].right = r;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
732 this->width = r + 1;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
733 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
734 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
735
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
736 static const NWidgetPart _nested_select_company_livery_widgets [] = {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
737 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
738 NWidget(WWT_CLOSEBOX, COLOUR_GREY, SCLW_WIDGET_CLOSE),
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
739 NWidget(WWT_CAPTION, COLOUR_GREY, SCLW_WIDGET_CAPTION), SetMinimalSize(389, 14), SetDataTip(STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
740 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
741 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
742 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_GENERAL), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
743 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_RAIL), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
744 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_ROAD), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRUCKLIST, STR_LIVERY_ROAD_VEHICLE_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
745 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_SHIP), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
746 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_AIRCRAFT), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
747 NWidget(WWT_PANEL, COLOUR_GREY, SCLW_WIDGET_SPACER_CLASS), SetMinimalSize(290, 22), EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
748 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
749 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
750 NWidget(WWT_PANEL, COLOUR_GREY, SCLW_WIDGET_SPACER_DROPDOWN), SetMinimalSize(150, 12), EndContainer(),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
751 NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_PRI_COL_DROPDOWN), SetMinimalSize(125, 12), SetDataTip(STR_BLACK_STRING, STR_LIVERY_PRIMARY_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
752 NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_SEC_COL_DROPDOWN), SetMinimalSize(125, 12), SetDataTip(STR_NETWORK_START_SERVER_LAN_INTERNET_COMBO, STR_LIVERY_SECONDARY_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
753 EndContainer(),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
754 NWidget(WWT_MATRIX, COLOUR_GREY, SCLW_WIDGET_MATRIX), SetMinimalSize(400, 15), SetDataTip((1 << MAT_ROW_START) | (1 << MAT_COL_START), STR_LIVERY_PANEL_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
755 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
756
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
757 static const Widget _select_company_livery_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
758 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW },
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
759 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 399, 0, 13, STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS },
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
760 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 21, 14, 35, SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TOOLTIP },
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
761 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 22, 43, 14, 35, SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TOOLTIP },
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
762 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 44, 65, 14, 35, SPR_IMG_TRUCKLIST, STR_LIVERY_ROAD_VEHICLE_TOOLTIP },
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
763 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 66, 87, 14, 35, SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TOOLTIP },
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
764 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 88, 109, 14, 35, SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TOOLTIP },
11086
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
765 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 110, 399, 14, 35, 0x0, STR_NULL },
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
766 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 149, 36, 47, 0x0, STR_NULL },
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
767 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_GREY, 150, 274, 36, 47, STR_BLACK_STRING, STR_LIVERY_PRIMARY_TOOLTIP },
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
768 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_GREY, 275, 399, 36, 47, STR_NETWORK_START_SERVER_LAN_INTERNET_COMBO, STR_LIVERY_SECONDARY_TOOLTIP },
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
769 { WWT_MATRIX, RESIZE_NONE, COLOUR_GREY, 0, 399, 48, 48 + 1 * 14, (1 << 8) | 1, STR_LIVERY_PANEL_TOOLTIP },
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
770 { WIDGETS_END },
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
771 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
772
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
773 static const WindowDesc _select_company_livery_desc(
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
774 WDP_AUTO, WDP_AUTO, 400, 49 + 1 * 14, 400, 49 + 1 * 14,
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
775 WC_COMPANY_COLOUR, WC_NONE,
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
776 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
777 _select_company_livery_widgets, _nested_select_company_livery_widgets, lengthof(_nested_select_company_livery_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
778 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
779
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
780 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
781 * Draws the face of a company manager's face.
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
782 * @param cmf the company manager's face
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
783 * @param colour the (background) colour of the gradient
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
784 * @param x x-position to draw the face
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
785 * @param y y-position to draw the face
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
786 */
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
787 void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, int x, int y)
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
788 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
789 GenderEthnicity ge = (GenderEthnicity)GetCompanyManagerFaceBits(cmf, CMFV_GEN_ETHN, GE_WM);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
790
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
791 bool has_moustache = !HasBit(ge, GENDER_FEMALE) && GetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE, ge) != 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
792 bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetCompanyManagerFaceBits(cmf, CMFV_HAS_TIE_EARRING, ge) != 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
793 bool has_glasses = GetCompanyManagerFaceBits(cmf, CMFV_HAS_GLASSES, ge) != 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
794 SpriteID pal;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
795
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
796 /* Modify eye colour palette only if 2 or more valid values exist */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
797 if (_cmf_info[CMFV_EYE_COLOUR].valid_values[ge] < 2) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
798 pal = PAL_NONE;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
799 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
800 switch (GetCompanyManagerFaceBits(cmf, CMFV_EYE_COLOUR, ge)) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
801 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
802 case 0: pal = PALETTE_TO_BROWN; break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
803 case 1: pal = PALETTE_TO_BLUE; break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
804 case 2: pal = PALETTE_TO_GREEN; break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
805 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
806 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
807
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
808 /* Draw the gradient (background) */
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
809 DrawSprite(SPR_GRADIENT, GENERAL_SPRITE_COLOUR(colour), x, y);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
810
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
811 for (CompanyManagerFaceVariable cmfv = CMFV_CHEEKS; cmfv < CMFV_END; cmfv++) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
812 switch (cmfv) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
813 case CMFV_MOUSTACHE: if (!has_moustache) continue; break;
11368
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
814 case CMFV_LIPS: // FALL THROUGH
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
815 case CMFV_NOSE: if (has_moustache) continue; break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
816 case CMFV_TIE_EARRING: if (!has_tie_earring) continue; break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
817 case CMFV_GLASSES: if (!has_glasses) continue; break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
818 default: break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
819 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
820 DrawSprite(GetCompanyManagerFaceSprite(cmf, cmfv, ge), (cmfv == CMFV_EYEBROWS) ? pal : PAL_NONE, x, y);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
821 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
822 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
823
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
824 /**
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
825 * Names of the widgets. Keep them in the same order as in the widget array.
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
826 * Do not change the order of the widgets from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
827 * this order is needed for the WE_CLICK event of DrawFaceStringLabel().
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
828 */
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
829 enum SelectCompanyManagerFaceWidgets {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
830 SCMFW_WIDGET_CLOSEBOX = 0,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
831 SCMFW_WIDGET_CAPTION,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
832 SCMFW_WIDGET_TOGGLE_LARGE_SMALL,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
833 SCMFW_WIDGET_SELECT_FACE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
834 SCMFW_WIDGET_CANCEL,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
835 SCMFW_WIDGET_ACCEPT,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
836 SCMFW_WIDGET_MALE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
837 SCMFW_WIDGET_FEMALE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
838 SCMFW_WIDGET_RANDOM_NEW_FACE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
839 SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON,
11519
70b260635f9f (svn r15880) -Codechange: add an invisible widget on company manager face windows to position company manager face image
glx <glx@openttd.org>
parents: 11518
diff changeset
840 SCMFM_WIDGET_FACE,
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
841 /* from here is the advanced company manager face selection window */
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
842 SCMFW_WIDGET_LOAD,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
843 SCMFW_WIDGET_FACECODE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
844 SCMFW_WIDGET_SAVE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
845 SCMFW_WIDGET_ETHNICITY_EUR,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
846 SCMFW_WIDGET_ETHNICITY_AFR,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
847 SCMFW_WIDGET_HAS_MOUSTACHE_EARRING,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
848 SCMFW_WIDGET_HAS_GLASSES,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
849 SCMFW_WIDGET_EYECOLOUR_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
850 SCMFW_WIDGET_EYECOLOUR,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
851 SCMFW_WIDGET_EYECOLOUR_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
852 SCMFW_WIDGET_CHIN_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
853 SCMFW_WIDGET_CHIN,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
854 SCMFW_WIDGET_CHIN_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
855 SCMFW_WIDGET_EYEBROWS_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
856 SCMFW_WIDGET_EYEBROWS,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
857 SCMFW_WIDGET_EYEBROWS_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
858 SCMFW_WIDGET_LIPS_MOUSTACHE_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
859 SCMFW_WIDGET_LIPS_MOUSTACHE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
860 SCMFW_WIDGET_LIPS_MOUSTACHE_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
861 SCMFW_WIDGET_NOSE_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
862 SCMFW_WIDGET_NOSE,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
863 SCMFW_WIDGET_NOSE_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
864 SCMFW_WIDGET_HAIR_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
865 SCMFW_WIDGET_HAIR,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
866 SCMFW_WIDGET_HAIR_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
867 SCMFW_WIDGET_JACKET_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
868 SCMFW_WIDGET_JACKET,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
869 SCMFW_WIDGET_JACKET_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
870 SCMFW_WIDGET_COLLAR_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
871 SCMFW_WIDGET_COLLAR,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
872 SCMFW_WIDGET_COLLAR_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
873 SCMFW_WIDGET_TIE_EARRING_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
874 SCMFW_WIDGET_TIE_EARRING,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
875 SCMFW_WIDGET_TIE_EARRING_R,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
876 SCMFW_WIDGET_GLASSES_L,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
877 SCMFW_WIDGET_GLASSES,
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
878 SCMFW_WIDGET_GLASSES_R,
11518
f34d6a91c077 (svn r15879) -Codechange: add an invisible widget on advanced company face window to determine where to draw the strings instead refering to other widgets. Required for rtl languages.
glx <glx@openttd.org>
parents: 11516
diff changeset
879 SCMFW_WIDGET_LABELS,
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
880 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
881
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
882 static const NWidgetPart _nested_select_company_manager_face_widgets[] = {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
883 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
884 NWidget(WWT_CLOSEBOX, COLOUR_GREY, SCMFW_WIDGET_CLOSEBOX),
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
885 NWidget(WWT_CAPTION, COLOUR_GREY, SCMFW_WIDGET_CAPTION), SetMinimalSize(164, 14), SetDataTip(STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
886 NWidget(WWT_IMGBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL), SetMinimalSize(15, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
887 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
888 NWidget(WWT_PANEL, COLOUR_GREY, SCMFW_WIDGET_SELECT_FACE),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
889 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
890 NWidget(NWID_SPACER), SetMinimalSize(2, 0),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
891 NWidget(NWID_VERTICAL),
11519
70b260635f9f (svn r15880) -Codechange: add an invisible widget on company manager face windows to position company manager face image
glx <glx@openttd.org>
parents: 11518
diff changeset
892 NWidget(WWT_EMPTY, COLOUR_GREY, SCMFM_WIDGET_FACE), SetMinimalSize(92, 119), SetPadding(2, 0, 2, 0),
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
893 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_RANDOM_NEW_FACE), SetMinimalSize(92, 12), SetDataTip(STR_FACE_NEW_FACE_BUTTON, STR_FACE_NEW_FACE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
894 NWidget(NWID_SPACER), SetMinimalSize(0, 2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
895 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
896 NWidget(NWID_SPACER), SetMinimalSize(1, 0),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
897 NWidget(NWID_VERTICAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
898 NWidget(NWID_SPACER), SetMinimalSize(0, 2),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
899 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON), SetMinimalSize(93, 12), SetDataTip(STR_FACE_ADVANCED, STR_FACE_ADVANCED_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
900 NWidget(NWID_SPACER), SetMinimalSize(0, 47),
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
901 NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_MALE), SetMinimalSize(93, 12), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP),
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
902 NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_FEMALE), SetMinimalSize(93, 12), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
903 NWidget(NWID_SPACER), SetMinimalSize(0, 52),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
904 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
905 NWidget(NWID_SPACER), SetMinimalSize(2, 0),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
906 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
907 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
908 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
909 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CANCEL), SetMinimalSize(95, 12), SetDataTip(STR_BUTTON_CANCEL, STR_FACE_CANCEL_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
910 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_ACCEPT), SetMinimalSize(95, 12), SetDataTip(STR_BUTTON_OK, STR_FACE_OK_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
911 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
912 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
913
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
914 /** Widget description for the normal/simple company manager face selection dialog */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
915 static const Widget _select_company_manager_face_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
916 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // SCMFW_WIDGET_CLOSEBOX
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
917 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 174, 0, 13, STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // SCMFW_WIDGET_CAPTION
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
918 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 189, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TOOLTIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
919 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 189, 14, 150, 0x0, STR_NULL}, // SCMFW_WIDGET_SELECT_FACE
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
920 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 94, 151, 162, STR_BUTTON_CANCEL, STR_FACE_CANCEL_TOOLTIP}, // SCMFW_WIDGET_CANCEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
921 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 189, 151, 162, STR_BUTTON_OK, STR_FACE_OK_TOOLTIP}, // SCMFW_WIDGET_ACCEPT
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
922 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 187, 75, 86, STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP}, // SCMFW_WIDGET_MALE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
923 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 187, 87, 98, STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP}, // SCMFW_WIDGET_FEMALE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
924 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 137, 148, STR_FACE_NEW_FACE_BUTTON, STR_FACE_NEW_FACE_TOOLTIP}, // SCMFW_WIDGET_RANDOM_NEW_FACE
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
925 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 187, 16, 27, STR_FACE_ADVANCED, STR_FACE_ADVANCED_TOOLTIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
926 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 2, 93, 16, 134, 0x0, STR_NULL}, // SCMFW_WIDGET_FACE
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
927 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
928 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
929
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
930 static const NWidgetPart _nested_select_company_manager_face_adv_widgets[] = {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
931 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
932 NWidget(WWT_CLOSEBOX, COLOUR_GREY, SCMFW_WIDGET_CLOSEBOX),
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
933 NWidget(WWT_CAPTION, COLOUR_GREY, SCMFW_WIDGET_CAPTION), SetMinimalSize(194, 14), SetDataTip(STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
934 NWidget(WWT_IMGBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL), SetMinimalSize(15, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_FACE_SIMPLE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
935 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
936 NWidget(WWT_PANEL, COLOUR_GREY, SCMFW_WIDGET_SELECT_FACE),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
937 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
938 NWidget(NWID_SPACER), SetMinimalSize(2, 0),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
939 NWidget(NWID_VERTICAL),
11519
70b260635f9f (svn r15880) -Codechange: add an invisible widget on company manager face windows to position company manager face image
glx <glx@openttd.org>
parents: 11518
diff changeset
940 NWidget(WWT_EMPTY, COLOUR_GREY, SCMFM_WIDGET_FACE), SetMinimalSize(92, 119), SetPadding(2, 0, 2, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
941 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_RANDOM_NEW_FACE), SetMinimalSize(92, 12), SetDataTip(STR_MAPGEN_RANDOM, STR_FACE_NEW_FACE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
942 NWidget(NWID_SPACER), SetMinimalSize(0, 9),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
943 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_LOAD), SetMinimalSize(92, 12), SetDataTip(STR_FACE_LOAD, STR_FACE_LOAD_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
944 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_FACECODE), SetMinimalSize(92, 12), SetDataTip(STR_FACE_FACECODE, STR_FACE_FACECODE_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
945 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_SAVE), SetMinimalSize(92, 12), SetDataTip(STR_FACE_SAVE, STR_FACE_SAVE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
946 NWidget(NWID_SPACER), SetMinimalSize(0, 14),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
947 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
948 NWidget(NWID_SPACER), SetMinimalSize(1, 0),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
949 NWidget(NWID_VERTICAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
950 NWidget(NWID_SPACER), SetMinimalSize(0, 2),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
951 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON), SetMinimalSize(123, 12), SetDataTip(STR_FACE_SIMPLE, STR_FACE_SIMPLE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
952 NWidget(NWID_SPACER), SetMinimalSize(0, 4),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
953 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
954 NWidget(NWID_SPACER), SetMinimalSize(1, 0),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
955 NWidget(NWID_VERTICAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
956 NWidget(NWID_HORIZONTAL),
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
957 NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_MALE), SetMinimalSize(61, 12), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP),
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
958 NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_FEMALE), SetMinimalSize(61, 12), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
959 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
960 NWidget(NWID_SPACER), SetMinimalSize(0, 2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
961 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
962 NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_ETHNICITY_EUR), SetMinimalSize(61, 12), SetDataTip(STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
963 NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_ETHNICITY_AFR), SetMinimalSize(61, 12), SetDataTip(STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
964 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
965 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
966 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
967 NWidget(NWID_SPACER), SetMinimalSize(0, 2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
968 NWidget(NWID_HORIZONTAL),
11518
f34d6a91c077 (svn r15879) -Codechange: add an invisible widget on advanced company face window to determine where to draw the strings instead refering to other widgets. Required for rtl languages.
glx <glx@openttd.org>
parents: 11516
diff changeset
969 NWidget(WWT_EMPTY, COLOUR_GREY, SCMFW_WIDGET_LABELS), SetMinimalSize(75, 146), SetPadding(0, 4, 0, 1),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
970 NWidget(NWID_VERTICAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
971 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAS_MOUSTACHE_EARRING), SetMinimalSize(43, 12), SetDataTip(STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
972 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAS_GLASSES), SetMinimalSize(43, 12), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
973 NWidget(NWID_SPACER), SetMinimalSize(0, 2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
974 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
975 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_HAIR_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
976 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
977 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_HAIR_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
978 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
979 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
980 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_EYEBROWS_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
981 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
982 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_EYEBROWS_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
983 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
984 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
985 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_EYECOLOUR_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
986 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
987 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_EYECOLOUR_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
988 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
989 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
990 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_GLASSES_TOOLTIP_2),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
991 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
992 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_GLASSES_TOOLTIP_2),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
993 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
994 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
995 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_NOSE_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
996 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
997 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_NOSE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
998 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
999 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1000 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1001 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1002 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1003 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1004 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1005 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_CHIN_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1006 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1007 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_CHIN_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1008 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1009 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1010 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_JACKET_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1011 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1012 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_JACKET_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1013 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1014 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1015 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_COLLAR_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1016 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1017 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_COLLAR_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1018 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1019 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1020 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_TIE_EARRING_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1021 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1022 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_TIE_EARRING_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1023 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1024 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1025 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1026 NWidget(NWID_SPACER), SetMinimalSize(0, 2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1027 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1028 NWidget(NWID_SPACER), SetMinimalSize(2, 0),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1029 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1030 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1031 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1032 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CANCEL), SetMinimalSize(95, 12), SetDataTip(STR_BUTTON_CANCEL, STR_FACE_CANCEL_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1033 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_ACCEPT), SetMinimalSize(125, 12), SetDataTip(STR_BUTTON_OK, STR_FACE_OK_TOOLTIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1034 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1035 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1036
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1037 /** Widget description for the advanced company manager face selection dialog */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1038 static const Widget _select_company_manager_face_adv_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1039 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // SCMFW_WIDGET_CLOSEBOX
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1040 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 204, 0, 13, STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // SCMFW_WIDGET_CAPTION
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1041 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 205, 219, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_FACE_SIMPLE_TOOLTIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1042 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 219, 14, 207, 0x0, STR_NULL}, // SCMFW_WIDGET_SELECT_FACE
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1043 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 94, 208, 219, STR_BUTTON_CANCEL, STR_FACE_CANCEL_TOOLTIP}, // SCMFW_WIDGET_CANCEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1044 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 219, 208, 219, STR_BUTTON_OK, STR_FACE_OK_TOOLTIP}, // SCMFW_WIDGET_ACCEPT
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1045 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 96, 156, 32, 43, STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP}, // SCMFW_WIDGET_MALE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1046 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 157, 217, 32, 43, STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP}, // SCMFW_WIDGET_FEMALE
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1047 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 137, 148, STR_MAPGEN_RANDOM, STR_FACE_NEW_FACE_TOOLTIP}, // SCMFW_WIDGET_RANDOM_NEW_FACE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1048 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 217, 16, 27, STR_FACE_SIMPLE, STR_FACE_SIMPLE_TOOLTIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON
11519
70b260635f9f (svn r15880) -Codechange: add an invisible widget on company manager face windows to position company manager face image
glx <glx@openttd.org>
parents: 11518
diff changeset
1049 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 2, 93, 16, 134, 0x0, STR_NULL}, // SCMFW_WIDGET_FACE
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1050 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 158, 169, STR_FACE_LOAD, STR_FACE_LOAD_TOOLTIP}, // SCMFW_WIDGET_LOAD
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1051 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 170, 181, STR_FACE_FACECODE, STR_FACE_FACECODE_TOOLTIP}, // SCMFW_WIDGET_FACECODE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1052 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 182, 193, STR_FACE_SAVE, STR_FACE_SAVE_TOOLTIP}, // SCMFW_WIDGET_SAVE
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1053 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 96, 156, 46, 57, STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN}, // SCMFW_WIDGET_ETHNICITY_EUR
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1054 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 157, 217, 46, 57, STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN}, // SCMFW_WIDGET_ETHNICITY_AFR
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1055 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 175, 217, 60, 71, STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TOOLTIP}, // SCMFW_WIDGET_HAS_MOUSTACHE_EARRING
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1056 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 175, 217, 72, 83, STR_EMPTY, STR_FACE_GLASSES_TOOLTIP}, // SCMFW_WIDGET_HAS_GLASSES
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1057 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 110, 121, SPR_ARROW_LEFT, STR_FACE_EYECOLOUR_TOOLTIP}, // SCMFW_WIDGET_EYECOLOUR_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1058 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 110, 121, STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP}, // SCMFW_WIDGET_EYECOLOUR
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1059 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 110, 121, SPR_ARROW_RIGHT, STR_FACE_EYECOLOUR_TOOLTIP}, // SCMFW_WIDGET_EYECOLOUR_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1060 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 158, 169, SPR_ARROW_LEFT, STR_FACE_CHIN_TOOLTIP}, // SCMFW_WIDGET_CHIN_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1061 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 158, 169, STR_EMPTY, STR_FACE_CHIN_TOOLTIP}, // SCMFW_WIDGET_CHIN
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1062 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 158, 169, SPR_ARROW_RIGHT, STR_FACE_CHIN_TOOLTIP}, // SCMFW_WIDGET_CHIN_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1063 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 98, 109, SPR_ARROW_LEFT, STR_FACE_EYEBROWS_TOOLTIP}, // SCMFW_WIDGET_EYEBROWS_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1064 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 98, 109, STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP}, // SCMFW_WIDGET_EYEBROWS
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1065 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 98, 109, SPR_ARROW_RIGHT, STR_FACE_EYEBROWS_TOOLTIP}, // SCMFW_WIDGET_EYEBROWS_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1066 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 146, 157, SPR_ARROW_LEFT, STR_FACE_LIPS_MOUSTACHE_TOOLTIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1067 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 146, 157, STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1068 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 146, 157, SPR_ARROW_RIGHT, STR_FACE_LIPS_MOUSTACHE_TOOLTIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1069 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 134, 145, SPR_ARROW_LEFT, STR_FACE_NOSE_TOOLTIP}, // SCMFW_WIDGET_NOSE_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1070 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 134, 145, STR_EMPTY, STR_FACE_NOSE_TOOLTIP}, // SCMFW_WIDGET_NOSE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1071 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 134, 145, SPR_ARROW_RIGHT, STR_FACE_NOSE_TOOLTIP}, // SCMFW_WIDGET_NOSE_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1072 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 86, 97, SPR_ARROW_LEFT, STR_FACE_HAIR_TOOLTIP}, // SCMFW_WIDGET_HAIR_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1073 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 86, 97, STR_EMPTY, STR_FACE_HAIR_TOOLTIP}, // SCMFW_WIDGET_HAIR
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1074 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 86, 97, SPR_ARROW_RIGHT, STR_FACE_HAIR_TOOLTIP}, // SCMFW_WIDGET_HAIR_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1075 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 170, 181, SPR_ARROW_LEFT, STR_FACE_JACKET_TOOLTIP}, // SCMFW_WIDGET_JACKET_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1076 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 170, 181, STR_EMPTY, STR_FACE_JACKET_TOOLTIP}, // SCMFW_WIDGET_JACKET
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1077 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 170, 181, SPR_ARROW_RIGHT, STR_FACE_JACKET_TOOLTIP}, // SCMFW_WIDGET_JACKET_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1078 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 182, 193, SPR_ARROW_LEFT, STR_FACE_COLLAR_TOOLTIP}, // SCMFW_WIDGET_COLLAR_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1079 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 182, 193, STR_EMPTY, STR_FACE_COLLAR_TOOLTIP}, // SCMFW_WIDGET_COLLAR
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1080 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 182, 193, SPR_ARROW_RIGHT, STR_FACE_COLLAR_TOOLTIP}, // SCMFW_WIDGET_COLLAR_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1081 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 194, 205, SPR_ARROW_LEFT, STR_FACE_TIE_EARRING_TOOLTIP}, // SCMFW_WIDGET_TIE_EARRING_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1082 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 194, 205, STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP}, // SCMFW_WIDGET_TIE_EARRING
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1083 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 194, 205, SPR_ARROW_RIGHT, STR_FACE_TIE_EARRING_TOOLTIP}, // SCMFW_WIDGET_TIE_EARRING_R
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1084 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 122, 133, SPR_ARROW_LEFT, STR_FACE_GLASSES_TOOLTIP_2}, // SCMFW_WIDGET_GLASSES_L
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1085 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 122, 133, STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2}, // SCMFW_WIDGET_GLASSES
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1086 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 122, 133, SPR_ARROW_RIGHT, STR_FACE_GLASSES_TOOLTIP_2}, // SCMFW_WIDGET_GLASSES_R
11518
f34d6a91c077 (svn r15879) -Codechange: add an invisible widget on advanced company face window to determine where to draw the strings instead refering to other widgets. Required for rtl languages.
glx <glx@openttd.org>
parents: 11516
diff changeset
1087 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 96, 170, 60, 205, 0x0, STR_NULL}, // SCMFW_WIDGET_LABELS
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1088 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1089 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1090
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1091 class SelectCompanyManagerFaceWindow : public Window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1092 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1093 CompanyManagerFace face; ///< company manager face bits
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1094 bool advanced; ///< advanced company manager face selection window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1095
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1096 GenderEthnicity ge;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1097 bool is_female;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1098 bool is_moust_male;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1099
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1100 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1101 * Draw dynamic a label to the left of the button and a value in the button
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1102 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1103 * @param widget_index index of this widget in the window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1104 * @param str the label which will be draw
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1105 * @param val the value which will be draw
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1106 * @param is_bool_widget is it a bool button
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1107 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1108 void DrawFaceStringLabel(byte widget_index, StringID str, uint8 val, bool is_bool_widget)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1109 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1110 /* Write the label in gold (0x2) to the left of the button. */
11518
f34d6a91c077 (svn r15879) -Codechange: add an invisible widget on advanced company face window to determine where to draw the strings instead refering to other widgets. Required for rtl languages.
glx <glx@openttd.org>
parents: 11516
diff changeset
1111 DrawString(this->widget[SCMFW_WIDGET_LABELS].left, this->widget[SCMFW_WIDGET_LABELS].right, this->widget[widget_index].top + 1, str, TC_GOLD, SA_RIGHT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1112
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1113 if (!this->IsWidgetDisabled(widget_index)) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1114 if (is_bool_widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1115 /* if it a bool button write yes or no */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1116 str = (val != 0) ? STR_FACE_YES : STR_FACE_NO;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1117 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1118 /* else write the value + 1 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1119 SetDParam(0, val + 1);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1120 str = STR_JUST_INT;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1121 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1122
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1123 /* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */
11432
a20dd0000d96 (svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents: 11425
diff changeset
1124 DrawString(this->widget[widget_index].left + this->IsWidgetLowered(widget_index), this->widget[widget_index].right - this->IsWidgetLowered(widget_index),
a20dd0000d96 (svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents: 11425
diff changeset
1125 this->widget[widget_index].top + 1 + this->IsWidgetLowered(widget_index), str, TC_WHITE, SA_CENTER);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1126 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1127 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1128
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1129 void UpdateData()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1130 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1131 this->ge = (GenderEthnicity)GB(this->face, _cmf_info[CMFV_GEN_ETHN].offset, _cmf_info[CMFV_GEN_ETHN].length); // get the gender and ethnicity
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1132 this->is_female = HasBit(this->ge, GENDER_FEMALE); // get the gender: 0 == male and 1 == female
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1133 this->is_moust_male = !is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE, this->ge) != 0; // is a male face with moustache
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1134 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1135
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1136 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1137 SelectCompanyManagerFaceWindow(const WindowDesc *desc, Window *parent, bool advanced, int top, int left) : Window(desc, parent->window_number)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1138 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1139 this->parent = parent;
11084
e07c7d3925c8 (svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents: 10998
diff changeset
1140 this->owner = (Owner)this->window_number;
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1141 this->face = Company::Get((CompanyID)this->window_number)->face;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1142 this->advanced = advanced;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1143
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1144 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1145
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1146 /* Check if repositioning from default is required */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1147 if (top != FIRST_GUI_CALL && left != FIRST_GUI_CALL) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1148 this->top = top;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1149 this->left = left;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1150 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1151
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1152 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1153 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1154
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1155 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1156 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1157 /* lower the non-selected gender button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1158 this->SetWidgetLoweredState(SCMFW_WIDGET_MALE, !this->is_female);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1159 this->SetWidgetLoweredState(SCMFW_WIDGET_FEMALE, this->is_female);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1160
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1161 /* advanced company manager face selection window */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1162 if (this->advanced) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1163 /* lower the non-selected ethnicity button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1164 this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_EUR, !HasBit(this->ge, ETHNICITY_BLACK));
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1165 this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_AFR, HasBit(this->ge, ETHNICITY_BLACK));
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1166
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1167
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1168 /* Disable dynamically the widgets which CompanyManagerFaceVariable has less than 2 options
11361
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1169 * (or in other words you haven't any choice).
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1170 * If the widgets depend on a HAS-variable and this is false the widgets will be disabled, too. */
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1171
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1172 /* Eye colour buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1173 this->SetWidgetsDisabledState(_cmf_info[CMFV_EYE_COLOUR].valid_values[this->ge] < 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1174 SCMFW_WIDGET_EYECOLOUR, SCMFW_WIDGET_EYECOLOUR_L, SCMFW_WIDGET_EYECOLOUR_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1175
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1176 /* Chin buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1177 this->SetWidgetsDisabledState(_cmf_info[CMFV_CHIN].valid_values[this->ge] < 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1178 SCMFW_WIDGET_CHIN, SCMFW_WIDGET_CHIN_L, SCMFW_WIDGET_CHIN_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1179
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1180 /* Eyebrows buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1181 this->SetWidgetsDisabledState(_cmf_info[CMFV_EYEBROWS].valid_values[this->ge] < 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1182 SCMFW_WIDGET_EYEBROWS, SCMFW_WIDGET_EYEBROWS_L, SCMFW_WIDGET_EYEBROWS_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1183
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1184 /* Lips or (if it a male face with a moustache) moustache buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1185 this->SetWidgetsDisabledState(_cmf_info[this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS].valid_values[this->ge] < 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1186 SCMFW_WIDGET_LIPS_MOUSTACHE, SCMFW_WIDGET_LIPS_MOUSTACHE_L, SCMFW_WIDGET_LIPS_MOUSTACHE_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1187
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1188 /* Nose buttons | male faces with moustache haven't any nose options */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1189 this->SetWidgetsDisabledState(_cmf_info[CMFV_NOSE].valid_values[this->ge] < 2 || this->is_moust_male,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1190 SCMFW_WIDGET_NOSE, SCMFW_WIDGET_NOSE_L, SCMFW_WIDGET_NOSE_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1191
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1192 /* Hair buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1193 this->SetWidgetsDisabledState(_cmf_info[CMFV_HAIR].valid_values[this->ge] < 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1194 SCMFW_WIDGET_HAIR, SCMFW_WIDGET_HAIR_L, SCMFW_WIDGET_HAIR_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1195
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1196 /* Jacket buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1197 this->SetWidgetsDisabledState(_cmf_info[CMFV_JACKET].valid_values[this->ge] < 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1198 SCMFW_WIDGET_JACKET, SCMFW_WIDGET_JACKET_L, SCMFW_WIDGET_JACKET_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1199
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1200 /* Collar buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1201 this->SetWidgetsDisabledState(_cmf_info[CMFV_COLLAR].valid_values[this->ge] < 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1202 SCMFW_WIDGET_COLLAR, SCMFW_WIDGET_COLLAR_L, SCMFW_WIDGET_COLLAR_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1203
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1204 /* Tie/earring buttons | female faces without earring haven't any earring options */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1205 this->SetWidgetsDisabledState(_cmf_info[CMFV_TIE_EARRING].valid_values[this->ge] < 2 ||
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1206 (this->is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge) == 0),
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1207 SCMFW_WIDGET_TIE_EARRING, SCMFW_WIDGET_TIE_EARRING_L, SCMFW_WIDGET_TIE_EARRING_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1209 /* Glasses buttons | faces without glasses haven't any glasses options */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1210 this->SetWidgetsDisabledState(_cmf_info[CMFV_GLASSES].valid_values[this->ge] < 2 || GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge) == 0,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1211 SCMFW_WIDGET_GLASSES, SCMFW_WIDGET_GLASSES_L, SCMFW_WIDGET_GLASSES_R, WIDGET_LIST_END);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1212 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1213
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1214 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1215
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1216 /* Draw dynamic button value and labels for the advanced company manager face selection window */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1217 if (this->advanced) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1218 if (this->is_female) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1219 /* Only for female faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1220 this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, STR_FACE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge), true );
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1221 this->DrawFaceStringLabel(SCMFW_WIDGET_TIE_EARRING, STR_FACE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1222 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1223 /* Only for male faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1224 this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, STR_FACE_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE, this->ge), true );
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1225 this->DrawFaceStringLabel(SCMFW_WIDGET_TIE_EARRING, STR_FACE_TIE, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1226 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1227 if (this->is_moust_male) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1228 /* Only for male faces with moustache */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1229 this->DrawFaceStringLabel(SCMFW_WIDGET_LIPS_MOUSTACHE, STR_FACE_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_MOUSTACHE, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1230 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1231 /* Only for female faces or male faces without moustache */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1232 this->DrawFaceStringLabel(SCMFW_WIDGET_LIPS_MOUSTACHE, STR_FACE_LIPS, GetCompanyManagerFaceBits(this->face, CMFV_LIPS, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1233 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1234 /* For all faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1235 this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_GLASSES, STR_FACE_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge), true );
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1236 this->DrawFaceStringLabel(SCMFW_WIDGET_HAIR, STR_FACE_HAIR, GetCompanyManagerFaceBits(this->face, CMFV_HAIR, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1237 this->DrawFaceStringLabel(SCMFW_WIDGET_EYEBROWS, STR_FACE_EYEBROWS, GetCompanyManagerFaceBits(this->face, CMFV_EYEBROWS, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1238 this->DrawFaceStringLabel(SCMFW_WIDGET_EYECOLOUR, STR_FACE_EYECOLOUR, GetCompanyManagerFaceBits(this->face, CMFV_EYE_COLOUR, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1239 this->DrawFaceStringLabel(SCMFW_WIDGET_GLASSES, STR_FACE_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_GLASSES, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1240 this->DrawFaceStringLabel(SCMFW_WIDGET_NOSE, STR_FACE_NOSE, GetCompanyManagerFaceBits(this->face, CMFV_NOSE, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1241 this->DrawFaceStringLabel(SCMFW_WIDGET_CHIN, STR_FACE_CHIN, GetCompanyManagerFaceBits(this->face, CMFV_CHIN, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1242 this->DrawFaceStringLabel(SCMFW_WIDGET_JACKET, STR_FACE_JACKET, GetCompanyManagerFaceBits(this->face, CMFV_JACKET, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1243 this->DrawFaceStringLabel(SCMFW_WIDGET_COLLAR, STR_FACE_COLLAR, GetCompanyManagerFaceBits(this->face, CMFV_COLLAR, this->ge), false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1244 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1245
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1246 /* Draw the company manager face picture */
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1247 DrawCompanyManagerFace(this->face, Company::Get((CompanyID)this->window_number)->colour, this->widget[SCMFM_WIDGET_FACE].left, this->widget[SCMFM_WIDGET_FACE].top);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1248 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1249
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1250 virtual void OnClick(Point pt, int widget)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1251 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1252 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1253 /* Toggle size, advanced/simple face selection */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1254 case SCMFW_WIDGET_TOGGLE_LARGE_SMALL:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1255 case SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON: {
10499
45ca88a8de7d (svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents: 10209
diff changeset
1256 DoCommandP(0, 0, this->face, CMD_SET_COMPANY_MANAGER_FACE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1257
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1258 /* Backup some data before deletion */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1259 int oldtop = this->top; ///< current top position of the window before closing it
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1260 int oldleft = this->left; ///< current top position of the window before closing it
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1261 bool adv = !this->advanced;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1262 Window *parent = this->parent;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1263
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1264 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1265
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1266 /* Open up the (toggled size) Face selection window at the same position as the previous */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1267 DoSelectCompanyManagerFace(parent, adv, oldtop, oldleft);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1268 } break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1269
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1270
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1271 /* OK button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1272 case SCMFW_WIDGET_ACCEPT:
10499
45ca88a8de7d (svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents: 10209
diff changeset
1273 DoCommandP(0, 0, this->face, CMD_SET_COMPANY_MANAGER_FACE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1274 /* Fall-Through */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1275
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1276 /* Cancel button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1277 case SCMFW_WIDGET_CANCEL:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1278 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1279 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1280
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1281 /* Load button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1282 case SCMFW_WIDGET_LOAD:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1283 this->face = _company_manager_face;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1284 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1285 ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1286 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1287 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1288 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1289
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1290 /* 'Company manager face number' button, view and/or set company manager face number */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1291 case SCMFW_WIDGET_FACECODE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1292 SetDParam(0, this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1293 ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, 0, this, CS_NUMERAL, QSF_NONE);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1294 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1295
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1296 /* Save button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1297 case SCMFW_WIDGET_SAVE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1298 _company_manager_face = this->face;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1299 ShowErrorMessage(INVALID_STRING_ID, STR_FACE_SAVE_DONE, 0, 0);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1300 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1301
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1302 /* Toggle gender (male/female) button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1303 case SCMFW_WIDGET_MALE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1304 case SCMFW_WIDGET_FEMALE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1305 SetCompanyManagerFaceBits(this->face, CMFV_GENDER, this->ge, widget - SCMFW_WIDGET_MALE);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1306 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1307 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1308 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1309 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1310
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1311 /* Randomize face button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1312 case SCMFW_WIDGET_RANDOM_NEW_FACE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1313 RandomCompanyManagerFaceBits(this->face, this->ge, this->advanced);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1314 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1315 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1316 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1317
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1318 /* Toggle ethnicity (european/african) button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1319 case SCMFW_WIDGET_ETHNICITY_EUR:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1320 case SCMFW_WIDGET_ETHNICITY_AFR:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1321 SetCompanyManagerFaceBits(this->face, CMFV_ETHNICITY, this->ge, widget - SCMFW_WIDGET_ETHNICITY_EUR);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1322 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1323 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1324 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1325 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1326
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1327 default:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1328 /* For all buttons from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R is the same function.
11361
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1329 * Therefor is this combined function.
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1330 * First it checks which CompanyManagerFaceVariable will be change and then
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1331 * a: invert the value for boolean variables
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1332 * or b: it checks inside of IncreaseCompanyManagerFaceBits() if a left (_L) butten is pressed and then decrease else increase the variable */
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1333 if (this->advanced && widget >= SCMFW_WIDGET_HAS_MOUSTACHE_EARRING && widget <= SCMFW_WIDGET_GLASSES_R) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1334 CompanyManagerFaceVariable cmfv; // which CompanyManagerFaceVariable shall be edited
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1335
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1336 if (widget < SCMFW_WIDGET_EYECOLOUR_L) { // Bool buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1337 switch (widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1338 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1339 case 0: cmfv = this->is_female ? CMFV_HAS_TIE_EARRING : CMFV_HAS_MOUSTACHE; break; // Has earring/moustache button
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1340 case 1: cmfv = CMFV_HAS_GLASSES; break; // Has glasses button
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1341 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1342 SetCompanyManagerFaceBits(this->face, cmfv, this->ge, !GetCompanyManagerFaceBits(this->face, cmfv, this->ge));
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1343 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1344 } else { // Value buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1345 switch ((widget - SCMFW_WIDGET_EYECOLOUR_L) / 3) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1346 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1347 case 0: cmfv = CMFV_EYE_COLOUR; break; // Eye colour buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1348 case 1: cmfv = CMFV_CHIN; break; // Chin buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1349 case 2: cmfv = CMFV_EYEBROWS; break; // Eyebrows buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1350 case 3: cmfv = this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS; break; // Moustache or lips buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1351 case 4: cmfv = CMFV_NOSE; break; // Nose buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1352 case 5: cmfv = CMFV_HAIR; break; // Hair buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1353 case 6: cmfv = CMFV_JACKET; break; // Jacket buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1354 case 7: cmfv = CMFV_COLLAR; break; // Collar buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1355 case 8: cmfv = CMFV_TIE_EARRING; break; // Tie/earring buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1356 case 9: cmfv = CMFV_GLASSES; break; // Glasses buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1357 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1358 /* 0 == left (_L), 1 == middle or 2 == right (_R) - button click */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1359 IncreaseCompanyManagerFaceBits(this->face, cmfv, this->ge, (((widget - SCMFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1360 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1361 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1362 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1363 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1364 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1365 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1366 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1367
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1368 virtual void OnQueryTextFinished(char *str)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1369 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1370 if (str == NULL) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1371 /* Set a new company manager face number */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1372 if (!StrEmpty(str)) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1373 this->face = strtoul(str, NULL, 10);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1374 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1375 ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1376 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1377 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1378 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1379 ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1380 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1381 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1382 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1383
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1384 /** normal/simple company manager face selection window description */
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1385 static const WindowDesc _select_company_manager_face_desc(
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1386 WDP_AUTO, WDP_AUTO, 190, 163, 190, 163,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1387 WC_COMPANY_MANAGER_FACE, WC_NONE,
10998
a1d256bf72e0 (svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company.
rubidium <rubidium@openttd.org>
parents: 10962
diff changeset
1388 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION,
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1389 _select_company_manager_face_widgets, _nested_select_company_manager_face_widgets, lengthof(_nested_select_company_manager_face_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1390 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1391
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1392 /** advanced company manager face selection window description */
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1393 static const WindowDesc _select_company_manager_face_adv_desc(
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1394 WDP_AUTO, WDP_AUTO, 220, 220, 220, 220,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1395 WC_COMPANY_MANAGER_FACE, WC_NONE,
10998
a1d256bf72e0 (svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company.
rubidium <rubidium@openttd.org>
parents: 10962
diff changeset
1396 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION,
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1397 _select_company_manager_face_adv_widgets, _nested_select_company_manager_face_adv_widgets, lengthof(_nested_select_company_manager_face_adv_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1398 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1399
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1400 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1401 * Open the simple/advanced company manager face selection window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1402 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1403 * @param parent the parent company window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1404 * @param adv simple or advanced face selection window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1405 * @param top previous top position of the window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1406 * @param left previous left position of the window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1407 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1408 static void DoSelectCompanyManagerFace(Window *parent, bool adv, int top, int left)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1409 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
1410 if (!Company::IsValidID((CompanyID)parent->window_number)) return;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1411
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1412 if (BringWindowToFrontById(WC_COMPANY_MANAGER_FACE, parent->window_number)) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1413 new SelectCompanyManagerFaceWindow(adv ? &_select_company_manager_face_adv_desc : &_select_company_manager_face_desc, parent, adv, top, left); // simple or advanced window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1414 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1415
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1416
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1417 /** Names of the widgets of the #CompanyWindow. Keep them in the same order as in the widget array */
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1418 enum CompanyWindowWidgets {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1419 CW_WIDGET_CLOSEBOX = 0,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1420 CW_WIDGET_CAPTION,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1421 CW_WIDGET_FACE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1422 CW_WIDGET_NEW_FACE,
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
1423 CW_WIDGET_COLOUR_SCHEME,
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1424 CW_WIDGET_PRESIDENT_NAME,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1425 CW_WIDGET_COMPANY_NAME,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1426 CW_WIDGET_BUILD_VIEW_HQ,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1427 CW_WIDGET_RELOCATE_HQ,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1428 CW_WIDGET_BUY_SHARE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1429 CW_WIDGET_SELL_SHARE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1430 CW_WIDGET_COMPANY_PASSWORD,
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1431 CW_WIDGET_COMPANY_JOIN,
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1432 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1433
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1434 static const Widget _company_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1435 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1436 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 359, 0, 13, STR_COMPANY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1437 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 359, 14, 157, 0x0, STR_NULL},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1438 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 89, 158, 169, STR_COMPANY_VIEW_NEW_FACE_BUTTON, STR_COMPANY_VIEW_NEW_FACE_TOOLTIP},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1439 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 90, 179, 158, 169, STR_COMPANY_VIEW_COLOUR_SCHEME_BUTTON, STR_COMPANY_VIEW_COLOUR_SCHEME_TOOLTIP},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1440 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 180, 269, 158, 169, STR_COMPANY_VIEW_PRESIDENT_NAME_BUTTON, STR_COMPANY_VIEW_PRESIDENT_NAME_TOOLTIP},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1441 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 270, 359, 158, 169, STR_COMPANY_VIEW_COMPANY_NAME_BUTTON, STR_COMPANY_VIEW_COMPANY_NAME_TOOLTIP},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1442 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 18, 29, STR_COMPANY_VIEW_VIEW_HQ_BUTTON, STR_COMPANY_VIEW_BUILD_HQ_TOOLTIP},
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1443 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 32, 43, STR_COMPANY_VIEW_RELOCATE_HQ, STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS},
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1444 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 179, 158, 169, STR_COMPANY_VIEW_BUY_SHARE_BUTTON, STR_COMPANY_VIEW_BUY_SHARE_TOOLTIP},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1445 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 180, 359, 158, 169, STR_COMPANY_VIEW_SELL_SHARE_BUTTON, STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP},
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1446 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 138, 149, STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP},
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1447 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 138, 149, STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP},
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1448 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1449 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1450
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1451 static const NWidgetPart _nested_company_widgets[] = {
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1452 NWidget(NWID_HORIZONTAL),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1453 NWidget(WWT_CLOSEBOX, COLOUR_GREY, CW_WIDGET_CLOSEBOX),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1454 NWidget(WWT_CAPTION, COLOUR_GREY, CW_WIDGET_CAPTION), SetDataTip(STR_COMPANY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1455 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1456 NWidget(WWT_PANEL, COLOUR_GREY, CW_WIDGET_FACE),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1457 NWidget(NWID_SPACER), SetMinimalSize(360, 4),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1458 NWidget(NWID_HORIZONTAL),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1459 NWidget(NWID_SPACER), SetFill(true, false),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1460 NWidget(WWT_TEXTBTN, COLOUR_GREY, CW_WIDGET_BUILD_VIEW_HQ), SetMinimalSize(90, 12), SetPadding(0, 4, 0, 0),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1461 SetDataTip(STR_COMPANY_VIEW_VIEW_HQ_BUTTON, STR_COMPANY_VIEW_BUILD_HQ_TOOLTIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1462 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1463 NWidget(NWID_SPACER), SetMinimalSize(0, 2),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1464 NWidget(NWID_HORIZONTAL),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1465 NWidget(NWID_SPACER), SetFill(true, false),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1466 NWidget(WWT_TEXTBTN, COLOUR_GREY, CW_WIDGET_RELOCATE_HQ), SetMinimalSize(90, 12), SetPadding(0, 4, 0, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1467 SetDataTip(STR_COMPANY_VIEW_RELOCATE_HQ, STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1468 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1469 NWidget(NWID_SPACER), SetMinimalSize(0, 94),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1470 /* Multi player buttons. */
13073
013c3a75e449 (svn r17573) -Codechange: NWID_SELECTION containers have a selected widget-plane, and optionally an index in the nested_array.
alberth <alberth@openttd.org>
parents: 13070
diff changeset
1471 NWidget(NWID_SELECTION, INVALID_COLOUR, -1),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1472 NWidget(NWID_HORIZONTAL),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1473 NWidget(NWID_SPACER), SetFill(true, false),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1474 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_PASSWORD), SetMinimalSize(90, 12), SetPadding(0, 4, 0, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1475 SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1476 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1477 NWidget(NWID_HORIZONTAL),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1478 NWidget(NWID_SPACER), SetFill(true, false),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1479 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_JOIN), SetMinimalSize(90, 12), SetPadding(0, 4, 0, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1480 SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1481 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1482 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1483 NWidget(NWID_SPACER), SetMinimalSize(0, 8),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1484 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1485 /* Button bars at the bottom. */
13073
013c3a75e449 (svn r17573) -Codechange: NWID_SELECTION containers have a selected widget-plane, and optionally an index in the nested_array.
alberth <alberth@openttd.org>
parents: 13070
diff changeset
1486 NWidget(NWID_SELECTION, INVALID_COLOUR, -1),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1487 NWidget(NWID_HORIZONTAL),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1488 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_NEW_FACE), SetMinimalSize(90, 12),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1489 SetDataTip(STR_COMPANY_VIEW_NEW_FACE_BUTTON, STR_COMPANY_VIEW_NEW_FACE_TOOLTIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1490 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COLOUR_SCHEME), SetMinimalSize(90, 12),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1491 SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_BUTTON, STR_COMPANY_VIEW_COLOUR_SCHEME_TOOLTIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1492 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_PRESIDENT_NAME), SetMinimalSize(90, 12),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1493 SetDataTip(STR_COMPANY_VIEW_PRESIDENT_NAME_BUTTON, STR_COMPANY_VIEW_PRESIDENT_NAME_TOOLTIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1494 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_NAME), SetMinimalSize(90, 12),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1495 SetDataTip(STR_COMPANY_VIEW_COMPANY_NAME_BUTTON, STR_COMPANY_VIEW_COMPANY_NAME_TOOLTIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1496 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1497 NWidget(NWID_HORIZONTAL),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1498 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_BUY_SHARE), SetMinimalSize(180, 12),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1499 SetDataTip(STR_COMPANY_VIEW_BUY_SHARE_BUTTON, STR_COMPANY_VIEW_BUY_SHARE_TOOLTIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1500 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_SELL_SHARE), SetMinimalSize(180, 12),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1501 SetDataTip(STR_COMPANY_VIEW_SELL_SHARE_BUTTON, STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1502 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1503 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1504 };
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1505
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1506 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1507 * Draws text "Vehicles:" and number of all vehicle types, or "(none)"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1508 * @param company ID of company to print statistics of
13070
1c4c4ae8d716 (svn r17570) -Fix: a number of Doxygen warnings about missing parameters, which were sometimes missing and sometimes just typos
rubidium <rubidium@openttd.org>
parents: 13034
diff changeset
1509 * @param right the right most location to draw to
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1510 */
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
1511 static void DrawCompanyVehiclesAmount(CompanyID company, int right)
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1512 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1513 const int x = 110;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1514 int y = 63;
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1515 uint amounts[] = { 0, 0, 0, 0 };
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1516
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1517 DrawString(x, right, y, STR_COMPANY_VIEW_VEHICLES_TITLE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1518
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1519 const Vehicle *v;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1520 FOR_ALL_VEHICLES(v) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1521 if (v->owner == company) {
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1522 if (v->IsPrimaryVehicle()) {
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1523 assert((size_t)v->type < lengthof(amounts));
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1524 amounts[v->type]++;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1525 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1526 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1527 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1528
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1529 if (amounts[0] + amounts[1] + amounts[2] + amounts[3] == 0) {
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1530 DrawString(x + 70, right, y, STR_COMPANY_VIEW_VEHICLES_NONE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1531 } else {
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1532 static const StringID strings[] = {
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1533 STR_COMPANY_VIEW_TRAINS, STR_COMPANY_VIEW_ROAD_VEHICLES, STR_COMPANY_VIEW_SHIPS, STR_COMPANY_VIEW_AIRCRAFT
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1534 };
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1535 assert_compile(lengthof(amounts) == lengthof(strings));
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1536
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1537 for (uint i = 0; i < lengthof(amounts); i++) {
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1538 if (amounts[i] != 0) {
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1539 SetDParam(0, amounts[i]);
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1540 DrawString(x + 70, right, y, strings[i]);
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1541 y += 10;
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1542 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1543 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1544 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1545 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1546
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1547 int GetAmountOwnedBy(const Company *c, Owner owner)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1548 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1549 return (c->share_owners[0] == owner) +
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1550 (c->share_owners[1] == owner) +
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1551 (c->share_owners[2] == owner) +
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1552 (c->share_owners[3] == owner);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1553 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1554
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1555 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1556 * Draws list of all companies with shares
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1557 * @param c pointer to the Company structure
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1558 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1559 static void DrawCompanyOwnerText(const Company *c)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1560 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1561 const Company *c2;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1562 uint num = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1563 const byte height = GetCharacterHeight(FS_NORMAL);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1564
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1565 FOR_ALL_COMPANIES(c2) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1566 uint amt = GetAmountOwnedBy(c, c2->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1567 if (amt != 0) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1568 SetDParam(0, amt * 25);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1569 SetDParam(1, c2->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1570
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1571 DrawString(120, 359, (num++) * height + 116, STR_COMPANY_VIEW_SHARES_OWNED_BY);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1572 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1573 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1574 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1575
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1576 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1577 * Window with general information about a company
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1578 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1579 struct CompanyWindow : Window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1580 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1581 CompanyWindowWidgets query_widget;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1582
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1583 CompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1584 {
11084
e07c7d3925c8 (svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents: 10998
diff changeset
1585 this->owner = (Owner)this->window_number;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1586 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1587 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1588
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1589 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1590 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1591 const Company *c = Company::Get((CompanyID)this->window_number);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1592 bool local = this->window_number == _local_company;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1593
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1594 this->SetWidgetHiddenState(CW_WIDGET_NEW_FACE, !local);
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
1595 this->SetWidgetHiddenState(CW_WIDGET_COLOUR_SCHEME, !local);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1596 this->SetWidgetHiddenState(CW_WIDGET_PRESIDENT_NAME, !local);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1597 this->SetWidgetHiddenState(CW_WIDGET_COMPANY_NAME, !local);
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1598 this->widget[CW_WIDGET_BUILD_VIEW_HQ].data = (local && c->location_of_HQ == INVALID_TILE) ? STR_COMPANY_VIEW_BUILD_HQ_BUTTON : STR_COMPANY_VIEW_VIEW_HQ_BUTTON;
11368
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
1599 if (local && c->location_of_HQ != INVALID_TILE) this->widget[CW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; // HQ is already built.
10555
315add01cf91 (svn r14812) -Codechange: use INVALID_TILE instead of 0 to mark company without HQ
smatz <smatz@openttd.org>
parents: 10500
diff changeset
1600 this->SetWidgetDisabledState(CW_WIDGET_BUILD_VIEW_HQ, !local && c->location_of_HQ == INVALID_TILE);
315add01cf91 (svn r14812) -Codechange: use INVALID_TILE instead of 0 to mark company without HQ
smatz <smatz@openttd.org>
parents: 10500
diff changeset
1601 this->SetWidgetHiddenState(CW_WIDGET_RELOCATE_HQ, !local || c->location_of_HQ == INVALID_TILE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1602 this->SetWidgetHiddenState(CW_WIDGET_BUY_SHARE, local);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1603 this->SetWidgetHiddenState(CW_WIDGET_SELL_SHARE, local);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1604 this->SetWidgetHiddenState(CW_WIDGET_COMPANY_PASSWORD, !local || !_networking);
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1605 this->SetWidgetHiddenState(CW_WIDGET_COMPANY_JOIN, local || !_networking);
12143
20abba1d6d18 (svn r16559) -Codechange: introduce Company::IsValidAiID() and Company::IsValidHumanID(), don't use IsHumanCompany() where possible
smatz <smatz@openttd.org>
parents: 11924
diff changeset
1606 this->SetWidgetDisabledState(CW_WIDGET_COMPANY_JOIN, c->is_ai);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1607
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1608 if (!local) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1609 if (_settings_game.economy.allow_shares) { // Shares are allowed
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1610 /* If all shares are owned by someone (none by nobody), disable buy button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1611 this->SetWidgetDisabledState(CW_WIDGET_BUY_SHARE, GetAmountOwnedBy(c, INVALID_OWNER) == 0 ||
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1612 /* Only 25% left to buy. If the company is human, disable buying it up.. TODO issues! */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1613 (GetAmountOwnedBy(c, INVALID_OWNER) == 1 && !c->is_ai) ||
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1614 /* Spectators cannot do anything of course */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1615 _local_company == COMPANY_SPECTATOR);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1616
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1617 /* If the company doesn't own any shares, disable sell button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1618 this->SetWidgetDisabledState(CW_WIDGET_SELL_SHARE, (GetAmountOwnedBy(c, _local_company) == 0) ||
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1619 /* Spectators cannot do anything of course */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1620 _local_company == COMPANY_SPECTATOR);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1621 } else { // Shares are not allowed, disable buy/sell buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1622 this->DisableWidget(CW_WIDGET_BUY_SHARE);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1623 this->DisableWidget(CW_WIDGET_SELL_SHARE);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1624 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1625 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1626
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1627 SetDParam(0, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1628 SetDParam(1, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1629
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1630 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1631
10912
338906f990f4 (svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents: 10907
diff changeset
1632 #ifdef ENABLE_NETWORK
338906f990f4 (svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents: 10907
diff changeset
1633 if (_networking && NetworkCompanyIsPassworded(c->index)) {
338906f990f4 (svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents: 10907
diff changeset
1634 DrawSprite(SPR_LOCK, PAL_NONE, this->widget[CW_WIDGET_COMPANY_JOIN].left - 10, this->widget[CW_WIDGET_COMPANY_JOIN].top + 2);
338906f990f4 (svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents: 10907
diff changeset
1635 }
338906f990f4 (svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents: 10907
diff changeset
1636 #endif /* ENABLE_NETWORK */
338906f990f4 (svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents: 10907
diff changeset
1637
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1638 /* Company manager's face */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1639 DrawCompanyManagerFace(c->face, c->colour, 2, 16);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1640
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1641 /* "xxx (Manager)" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1642 SetDParam(0, c->index);
11766
7f4acc4c2e51 (svn r16156) -Codechange: make the parameters of DrawStringMultiline the same as for DrawString (except the addition of the bottom parameter)
rubidium <rubidium@openttd.org>
parents: 11730
diff changeset
1643 DrawStringMultiLine(48 - MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 48 + MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 135, 157, STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE, TC_FROMSTRING, SA_CENTER);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1644
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1645 /* "Inaugurated:" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1646 SetDParam(0, c->inaugurated_year);
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1647 DrawString(110, this->width, 23, STR_COMPANY_VIEW_INAUGURATED_TITLE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1648
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1649 /* "Colour scheme:" */
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1650 DrawString(110, this->width, 43, STR_COMPANY_VIEW_COLOUR_SCHEME_TITLE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1651 /* Draw company-colour bus */
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
1652 DrawSprite(SPR_VEH_BUS_SW_VIEW, COMPANY_SPRITE_COLOUR(c->index), 215, 44);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1653
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1654 /* "Vehicles:" */
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
1655 DrawCompanyVehiclesAmount((CompanyID)this->window_number, this->width);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1656
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1657 /* "Company value:" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1658 SetDParam(0, CalculateCompanyValue(c));
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1659 DrawString(110, this->width, 106, STR_COMPANY_VIEW_COMPANY_VALUE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1660
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1661 /* Shares list */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1662 DrawCompanyOwnerText(c);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1663 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1664
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1665 virtual void OnClick(Point pt, int widget)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1666 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1667 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1668 case CW_WIDGET_NEW_FACE: DoSelectCompanyManagerFace(this, false); break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1669
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
1670 case CW_WIDGET_COLOUR_SCHEME:
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
1671 if (BringWindowToFrontById(WC_COMPANY_COLOUR, this->window_number)) break;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1672 new SelectCompanyLiveryWindow(&_select_company_livery_desc, (CompanyID)this->window_number);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1673 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1674
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1675 case CW_WIDGET_PRESIDENT_NAME:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1676 this->query_widget = CW_WIDGET_PRESIDENT_NAME;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1677 SetDParam(0, this->window_number);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1678 ShowQueryString(STR_PRESIDENT_NAME, STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION, MAX_LENGTH_PRESIDENT_NAME_BYTES, MAX_LENGTH_PRESIDENT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1679 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1680
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1681 case CW_WIDGET_COMPANY_NAME:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1682 this->query_widget = CW_WIDGET_COMPANY_NAME;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1683 SetDParam(0, this->window_number);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1684 ShowQueryString(STR_COMPANY_NAME, STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION, MAX_LENGTH_COMPANY_NAME_BYTES, MAX_LENGTH_COMPANY_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1685 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1686
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1687 case CW_WIDGET_BUILD_VIEW_HQ: {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1688 TileIndex tile = Company::Get((CompanyID)this->window_number)->location_of_HQ;
10555
315add01cf91 (svn r14812) -Codechange: use INVALID_TILE instead of 0 to mark company without HQ
smatz <smatz@openttd.org>
parents: 10500
diff changeset
1689 if (tile == INVALID_TILE) {
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1690 if ((byte)this->window_number != _local_company) return;
11702
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11519
diff changeset
1691 SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1692 SetTileSelectSize(2, 2);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1693 this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ);
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12789
diff changeset
1694 this->SetWidgetDirty(CW_WIDGET_BUILD_VIEW_HQ);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1695 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1696 if (_ctrl_pressed) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1697 ShowExtraViewPortWindow(tile);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1698 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1699 ScrollMainWindowToTile(tile);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1700 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1701 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1702 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1703 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1704
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1705 case CW_WIDGET_RELOCATE_HQ:
11702
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11519
diff changeset
1706 SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1707 SetTileSelectSize(2, 2);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1708 this->LowerWidget(CW_WIDGET_RELOCATE_HQ);
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12789
diff changeset
1709 this->SetWidgetDirty(CW_WIDGET_RELOCATE_HQ);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1710 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1711
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1712 case CW_WIDGET_BUY_SHARE:
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1713 DoCommandP(0, this->window_number, 0, CMD_BUY_SHARE_IN_COMPANY | CMD_MSG(STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS));
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1714 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1715
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1716 case CW_WIDGET_SELL_SHARE:
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1717 DoCommandP(0, this->window_number, 0, CMD_SELL_SHARE_IN_COMPANY | CMD_MSG(STR_ERROR_CAN_T_SELL_25_SHARE_IN));
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1718 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1719
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1720 #ifdef ENABLE_NETWORK
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1721 case CW_WIDGET_COMPANY_PASSWORD:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1722 if (this->window_number == _local_company) ShowNetworkCompanyPasswordWindow(this);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1723 break;
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1724
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1725 case CW_WIDGET_COMPANY_JOIN: {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1726 this->query_widget = CW_WIDGET_COMPANY_JOIN;
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1727 CompanyID company = (CompanyID)this->window_number;
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1728 if (_network_server) {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1729 NetworkServerDoMove(CLIENT_ID_SERVER, company);
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1730 MarkWholeScreenDirty();
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1731 } else if (NetworkCompanyIsPassworded(company)) {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1732 /* ask for the password */
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1733 ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION, 20, 180, this, CS_ALPHANUMERAL, QSF_NONE);
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1734 } else {
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1735 /* just send the join command */
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1736 NetworkClientRequestMove(company);
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1737 }
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1738 break;
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1739 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1740 #endif /* ENABLE_NETWORK */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1741 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1742 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1743
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1744 virtual void OnHundredthTick()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1745 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1746 /* redraw the window every now and then */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1747 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1748 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1749
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1750 virtual void OnPlaceObject(Point pt, TileIndex tile)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1751 {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1752 if (DoCommandP(tile, 0, 0, CMD_BUILD_COMPANY_HQ | CMD_MSG(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS)))
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1753 ResetObjectToPlace();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1754 this->widget[CW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; // this button can now behave as a normal push button
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1755 this->RaiseButtons();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1756 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1757
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1758 virtual void OnPlaceObjectAbort()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1759 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1760 this->RaiseButtons();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1761 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1762
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1763 virtual void OnQueryTextFinished(char *str)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1764 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1765 if (str == NULL) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1766
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1767 switch (this->query_widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1768 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1769
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1770 case CW_WIDGET_PRESIDENT_NAME:
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1771 DoCommandP(0, 0, 0, CMD_RENAME_PRESIDENT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_PRESIDENT), NULL, str);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1772 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1773
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1774 case CW_WIDGET_COMPANY_NAME:
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1775 DoCommandP(0, 0, 0, CMD_RENAME_COMPANY | CMD_MSG(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME), NULL, str);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1776 break;
10907
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1777
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1778 #ifdef ENABLE_NETWORK
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1779 case CW_WIDGET_COMPANY_JOIN:
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1780 NetworkClientRequestMove((CompanyID)this->window_number, str);
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1781 break;
96ac514d4239 (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
1782 #endif /* ENABLE_NETWORK */
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1783 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1784 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1785 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1786
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1787 static const WindowDesc _company_desc(
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1788 WDP_AUTO, WDP_AUTO, 360, 170, 360, 170,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1789 WC_COMPANY, WC_NONE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1790 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1791 _company_widgets, _nested_company_widgets,lengthof(_nested_company_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1792 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1793
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1794 void ShowCompany(CompanyID company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1795 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
1796 if (!Company::IsValidID(company)) return;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1797
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1798 AllocateWindowDescFront<CompanyWindow>(&_company_desc, company);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1799 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1800
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1801 /** widget numbers of the #BuyCompanyWindow. */
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1802 enum BuyCompanyWidgets {
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1803 BCW_CLOSEBOX,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1804 BCW_CAPTION,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1805 BCW_BACKGROUND,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1806 BCW_NO,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1807 BCW_YES,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1808 };
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1809
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1810 struct BuyCompanyWindow : Window {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1811 BuyCompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1812 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1813 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1814 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1815
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1816 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1817 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1818 Company *c = Company::Get((CompanyID)this->window_number);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1819 SetDParam(0, STR_COMPANY_NAME);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1820 SetDParam(1, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1821 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1822
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1823 DrawCompanyManagerFace(c->face, c->colour, 2, 16);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1824
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1825 SetDParam(0, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1826 SetDParam(1, c->bankrupt_value);
11766
7f4acc4c2e51 (svn r16156) -Codechange: make the parameters of DrawStringMultiline the same as for DrawString (except the addition of the bottom parameter)
rubidium <rubidium@openttd.org>
parents: 11730
diff changeset
1827 DrawStringMultiLine(95, 333, 26, 116, STR_BUY_COMPANY_MESSAGE, TC_FROMSTRING, SA_CENTER);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1828 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1829
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1830 virtual void OnClick(Point pt, int widget)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1831 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1832 switch (widget) {
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1833 case BCW_NO:
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1834 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1835 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1836
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1837 case BCW_YES:
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1838 DoCommandP(0, this->window_number, 0, CMD_BUY_COMPANY | CMD_MSG(STR_ERROR_CAN_T_BUY_COMPANY));
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1839 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1840 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1841 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1842 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1843
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1844 static const Widget _buy_company_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1845 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1846 { WWT_CAPTION, RESIZE_NONE, COLOUR_LIGHT_BLUE, 11, 333, 0, 13, STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
1847 { WWT_PANEL, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 333, 14, 136, 0x0, STR_NULL},
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1848 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 148, 207, 117, 128, STR_QUIT_NO, STR_NULL},
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1849 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 218, 277, 117, 128, STR_QUIT_YES, STR_NULL},
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1850 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1851 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1852
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1853 static const NWidgetPart _nested_buy_company_widgets[] = {
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1854 NWidget(NWID_HORIZONTAL),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1855 NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, BCW_CLOSEBOX),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1856 NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, BCW_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1857 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1858 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, BCW_BACKGROUND),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1859 NWidget(NWID_SPACER), SetMinimalSize(334, 103), SetFill(true, false),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1860 NWidget(NWID_HORIZONTAL),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1861 NWidget(NWID_SPACER), SetMinimalSize(148, 0), SetFill(true, false),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1862 NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_NO), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_NO, STR_NULL),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1863 NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetFill(true, false),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
1864 NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_YES), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_YES, STR_NULL),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1865 NWidget(NWID_SPACER), SetMinimalSize(56, 0), SetFill(true, false),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1866 EndContainer(),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
1867 NWidget(NWID_SPACER), SetMinimalSize(0, 8), SetFill(true, false),
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1868 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1869 };
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1870
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1871 static const WindowDesc _buy_company_desc(
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1872 153, 171, 334, 137, 334, 137,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1873 WC_BUY_COMPANY, WC_NONE,
10998
a1d256bf72e0 (svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company.
rubidium <rubidium@openttd.org>
parents: 10962
diff changeset
1874 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1875 _buy_company_widgets, _nested_buy_company_widgets, lengthof(_nested_buy_company_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11368
diff changeset
1876 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1877
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1878
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1879 void ShowBuyCompanyDialog(CompanyID company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1880 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1881 AllocateWindowDescFront<BuyCompanyWindow>(&_buy_company_desc, company);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1882 }