annotate src/company_gui.cpp @ 13034:6eb3f749890a draft

(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
author frosch <frosch@openttd.org>
date Sun, 13 Sep 2009 19:15:59 +0000
parents dd7db20331f6
children 1c4c4ae8d716
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"
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
23 #include "roadveh.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
24 #include "train.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
25 #include "aircraft.h"
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 "string_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
31 #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
32 #include "tilehighlight_func.h"
10960
a4e5b5d2837c (svn r15299) -Cleanup: remove many redundant includes
smatz <smatz@openttd.org>
parents: 10912
diff changeset
33 #include "settings_type.h"
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
34
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
35 #include "table/strings.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
36
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
37 enum {
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
38 FIRST_GUI_CALL = INT_MAX, ///< default value to specify this is the first call of the resizable gui
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
39 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
40
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
41 static void DoShowCompanyFinances(CompanyID company, bool show_small, bool show_stickied, 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
42 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
43
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
44 /** 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
45 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
46 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
47 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
48 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
49 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
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57 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
58 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
59 };
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 /** 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71 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
72 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
73 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
74 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
75 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
76 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
77 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
78 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
79 };
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 /** 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
82 struct ExpensesList {
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 const ExpensesType *et; ///< Expenses items.
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
84 const int length; ///< Number of items in list.
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
85 const int height; ///< Height of list, 10 pixels per item, plus an additional 12 pixels per subtotal. */
11897
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
86
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
87 ExpensesList(ExpensesType *et, int length, int height) :
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
88 et(et),
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
89 length(length),
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
90 height(height)
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
91 {
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
92 }
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
93 };
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
94
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
95 static const ExpensesList _expenses_list_types[] = {
11897
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
96 ExpensesList(_expenses_list_1, lengthof(_expenses_list_1), lengthof(_expenses_list_1) * 10),
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
97 ExpensesList(_expenses_list_2, lengthof(_expenses_list_2), lengthof(_expenses_list_2) * 10 + 3 * 12),
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
98 };
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
99
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
100 /** 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
101 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
102 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
103 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
104 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
105 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
106 CFW_EXPS_PANEL, ///< Panel for 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
107 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
108 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
109 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
110 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
111 CFW_TOTAL_PANEL, ///< Panel for totals
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
112 CFW_TOTAL_LABELS, ///< Column for totals labels
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
113 CFW_TOTAL_VALUES, ///< Column for totals values
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
114 CFW_TOTAL_MAXLOAN, ///< Column for max loan string
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
115 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
116 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
117 };
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
118
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
119 static void DrawCompanyEconomyStats(const Company *c, bool small, const Widget *widget)
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
120 {
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 int type = _settings_client.gui.expenses_layout;
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
122 int y;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
123 const Money (*tbl)[EXPENSES_END];
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
124 StringID str;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
125
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
126 if (!small) { // normal sized economics window
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
127 const Widget *w = &widget[CFW_EXPS_CATEGORY];
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
128 /* draw categories */
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
129 DrawString(w->left, w->right, 15, STR_FINANCES_EXPENDITURE_INCOME_TITLE, TC_FROMSTRING, SA_CENTER, true);
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
130
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
131 y = 27;
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
132 for (int i = 0; i < _expenses_list_types[type].length; i++) {
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
133 ExpensesType et = _expenses_list_types[type].et[i];
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
134 if (et == 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
135 y += 2;
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
136 DrawString(w->left + 2, w->right - 2, y, STR_FINANCES_TOTAL_CAPTION, TC_FROMSTRING, SA_RIGHT);
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
137 y += 20;
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
138 } else {
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
139 DrawString(w->left + 2, w->right - 2, y, STR_FINANCES_SECTION_CONSTRUCTION + et);
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
140 y += 10;
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
141 }
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
142 }
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
143
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
144 DrawString(w->left + 2, w->right - 2, y + 2, STR_FINANCES_TOTAL_CAPTION, TC_FROMSTRING, SA_RIGHT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
145
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
146 /* draw the price columns */
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
147 int year = _cur_year - 2;
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 int j = 3;
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 w++;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
150 tbl = c->yearly_expenses + 2;
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
151
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
152 do {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
153 if (year >= c->inaugurated_year) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
154 SetDParam(0, year);
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
155 DrawString(w->left, w->right, 15, STR_FINANCES_YEAR, TC_FROMSTRING, SA_RIGHT, true);
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
156
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
157 Money sum = 0;
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
158 Money subtotal = 0;
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
159
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
160 int y = 27;
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
161
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
162 for (int i = 0; i < _expenses_list_types[type].length; i++) {
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
163 ExpensesType et = _expenses_list_types[type].et[i];
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
164 Money cost;
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
165
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
166 if (et == INVALID_EXPENSES) {
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
167 GfxFillRect(w->left, y, w->right, y, 215);
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
168 cost = subtotal;
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
169 subtotal = 0;
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
170 y += 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
171 } else {
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
172 cost = (*tbl)[et];
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
173 subtotal += cost;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
174 sum += cost;
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
175 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
176
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
177 if (cost != 0 || et == INVALID_EXPENSES) {
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
178 str = STR_FINANCES_NEGATIVE_INCOME;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
179 if (cost < 0) { cost = -cost; str++; }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
180 SetDParam(0, cost);
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
181 DrawString(w->left, w->right, y, str, TC_FROMSTRING, SA_RIGHT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
182 }
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
183 y += (et == INVALID_EXPENSES) ? 20 : 10;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
184 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
185
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
186 str = STR_FINANCES_NEGATIVE_INCOME;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
187 if (sum < 0) { sum = -sum; str++; }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
188 SetDParam(0, sum);
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
189 DrawString(w->left, w->right, y + 2, str, TC_FROMSTRING, SA_RIGHT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
190
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
191 GfxFillRect(w->left, y, w->right, y, 215);
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
192 w++;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
193 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
194 year++;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
195 tbl--;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
196 } while (--j != 0);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
197
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
198 y += 14;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
199
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
200 /* draw max loan aligned to loan below (y += 10) */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
201 SetDParam(0, _economy.max_loan);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
202 DrawString(widget[CFW_TOTAL_MAXLOAN].left, widget[CFW_TOTAL_MAXLOAN].right, y + 10, STR_FINANCES_MAX_LOAN);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
203 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
204 y = 15;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
205 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
206
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
207 DrawString(widget[CFW_TOTAL_LABELS].left, widget[CFW_TOTAL_LABELS].right, y, STR_FINANCES_BANK_BALANCE_TITLE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
208 SetDParam(0, c->money);
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
209 DrawString(widget[CFW_TOTAL_VALUES].left, widget[CFW_TOTAL_VALUES].right, y, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
210
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
211 y += 10;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
212
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
213 DrawString(widget[CFW_TOTAL_LABELS].left, widget[CFW_TOTAL_LABELS].right, y, STR_FINANCES_LOAN_TITLE);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
214 SetDParam(0, c->current_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
215 DrawString(widget[CFW_TOTAL_VALUES].left, widget[CFW_TOTAL_VALUES].right, y, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
216
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
217 y += 12;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
218
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
219 GfxFillRect(widget[CFW_TOTAL_VALUES].left, y - 2, widget[CFW_TOTAL_VALUES].right, y - 2, 215);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
220
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
221 SetDParam(0, c->money - c->current_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
222 DrawString(widget[CFW_TOTAL_VALUES].left, widget[CFW_TOTAL_VALUES].right, y, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
223 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
224
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
225 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
226 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
227 NWidget(WWT_CLOSEBOX, COLOUR_GREY, CFW_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
228 NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetMinimalSize(369, 14), SetDataTip(STR_FINANCES_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
229 NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetMinimalSize(14, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
230 NWidget(WWT_STICKYBOX, COLOUR_GREY, CFW_STICKY),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
231 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
232 NWidget(WWT_PANEL, COLOUR_GREY, CFW_EXPS_PANEL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
233 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
234 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_CATEGORY), SetMinimalSize(123, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
235 NWidget(NWID_SPACER), SetMinimalSize(7, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
236 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE1), SetMinimalSize(86, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
237 NWidget(NWID_SPACER), SetMinimalSize(9, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
238 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE2), SetMinimalSize(86, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
239 NWidget(NWID_SPACER), SetMinimalSize(9, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
240 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE3), SetMinimalSize(86, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
241 NWidget(NWID_SPACER), SetMinimalSize(1, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
242 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
243 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
244 NWidget(WWT_PANEL, COLOUR_GREY, CFW_TOTAL_PANEL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
245 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
246 NWidget(NWID_SPACER), SetMinimalSize(2, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
247 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_LABELS), SetMinimalSize(95, 34),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
248 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_VALUES), SetMinimalSize(86, 34),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
249 NWidget(NWID_SPACER), SetMinimalSize(19, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
250 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_MAXLOAN), SetMinimalSize(205, 34),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
251 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
252 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
253 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
254 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INCREASE_LOAN), SetMinimalSize(203, 12), SetDataTip(STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_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
255 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_REPAY_LOAN), SetMinimalSize(204, 12), SetDataTip(STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
256 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
257 };
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
258
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
259 static const Widget _company_finances_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
260 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // CFW_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
261 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 380, 0, 13, STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // CFW_CAPTION
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
262 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 381, 394, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW}, // CFW_TOGGLE_SIZE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
263 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_GREY, 395, 406, 0, 13, 0x0, STR_TOOLTIP_STICKY}, // CFW_STICKY
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
264 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 406, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_PANEL
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
265 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 122, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_CATEGORY
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
266 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 130, 215, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_PRICE1
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
267 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 225, 310, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_PRICE2
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
268 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 320, 405, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_PRICE3
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
269 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 406, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_PANEL
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
270 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 2, 96, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_LABELS
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
271 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 97, 182, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_VALUES
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
272 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 202, 406, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_MAXLOAN
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
273 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 202, 48, 59, STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_TOOLTIP}, // CFW_INCREASE_LOAN
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
274 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 203, 406, 48, 59, STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP}, // CFW_REPAY_LOAN
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
275 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
276 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
277
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
278 static const NWidgetPart _nested_company_finances_small_widgets[] = {
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
279 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
280 NWidget(WWT_CLOSEBOX, COLOUR_GREY, CFW_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
281 NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetMinimalSize(243, 14), SetDataTip(STR_FINANCES_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
282 NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetMinimalSize(14, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
283 NWidget(WWT_STICKYBOX, COLOUR_GREY, CFW_STICKY),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
284 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
285 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PANEL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
286 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_CATEGORY),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
287 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE1),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
288 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE2),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
289 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE3),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
290 NWidget(WWT_PANEL, COLOUR_GREY, CFW_TOTAL_PANEL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
291 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
292 NWidget(NWID_SPACER), SetMinimalSize(2, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
293 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_LABELS), SetMinimalSize(95, 34),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
294 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_VALUES), SetMinimalSize(86, 34),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
295 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_MAXLOAN), SetMinimalSize(97, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
296 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
297 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
298 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
299 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INCREASE_LOAN), SetMinimalSize(140, 12), SetDataTip(STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_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
300 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_REPAY_LOAN), SetMinimalSize(140, 12), SetDataTip(STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
301 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
302 };
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
303
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
304 static const Widget _company_finances_small_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
305 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // CFW_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
306 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 253, 0, 13, STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // CFW_CAPTION
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
307 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 254, 267, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW}, // CFW_TOGGLE_SIZE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
308 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_GREY, 268, 279, 0, 13, 0x0, STR_TOOLTIP_STICKY}, // CFW_STICKY
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
309 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_PANEL
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
310 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_CATEGORY
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
311 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_PRICE1
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
312 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_PRICE2
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
313 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_PRICE3
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
314 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 279, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_PANEL
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
315 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 2, 96, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_LABELS
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
316 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 97, 182, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_VALUES
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
317 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_TOTAL_MAXLOAN
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
318 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 139, 48, 59, STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_TOOLTIP}, // CFW_INCREASE_LOAN
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
319 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 140, 279, 48, 59, STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP}, // CFW_REPAY_LOAN
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
320 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
321 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
322
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
323 struct CompanyFinancesWindow : Window {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
324 bool small;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
325
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
326 CompanyFinancesWindow(const WindowDesc *desc, CompanyID company, bool show_small,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
327 bool show_stickied, int top, int left) :
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
328 Window(desc, company),
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
329 small(show_small)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
330 {
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
331 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
332
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
333 if (show_stickied) this->flags4 |= WF_STICKY;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
334
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
335 /* 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
336 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
337 this->top = top;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
338 this->left = left;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
339 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
340
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
341 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
342 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
343
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
344 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
345 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
346 CompanyID company = (CompanyID)this->window_number;
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
347 const Company *c = Company::Get(company);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
348
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
349 if (!small) {
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
350 int type = _settings_client.gui.expenses_layout;
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
351 if (this->widget[CFW_EXPS_PANEL].bottom < this->widget[CFW_EXPS_PANEL].top) {
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
352 this->widget[CFW_EXPS_PANEL].bottom = this->widget[CFW_EXPS_PANEL].top;
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
353 }
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
354 int height = this->widget[CFW_EXPS_PANEL].bottom - this->widget[CFW_EXPS_PANEL].top + 1;
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
355 if (_expenses_list_types[type].height + 26 != height) {
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
356 this->SetDirty();
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
357 ResizeWindowForWidget(this, CFW_EXPS_PANEL, 0, _expenses_list_types[type].height - height + 26);
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
358 this->SetDirty();
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
359 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
360 }
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
361 }
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
362
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
363 /* Recheck the size of the window as it might need to be resized due to the local company changing */
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
364 int new_height = this->widget[(company == _local_company) ? CFW_INCREASE_LOAN : CFW_TOTAL_PANEL].bottom + 1;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
365 if (this->height != new_height) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
366 /* Make window dirty before and after resizing */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
367 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
368 this->height = new_height;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
369 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
370
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
371 this->SetWidgetHiddenState(CFW_INCREASE_LOAN, company != _local_company);
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
372 this->SetWidgetHiddenState(CFW_REPAY_LOAN, company != _local_company);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
373 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
374
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
375 /* Borrow button only shows when there is any more money to loan */
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
376 this->SetWidgetDisabledState(CFW_INCREASE_LOAN, c->current_loan == _economy.max_loan);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
377
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
378 /* Repay button only shows when there is any more money to repay */
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
379 this->SetWidgetDisabledState(CFW_REPAY_LOAN, company != _local_company || c->current_loan == 0);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
380
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
381 SetDParam(0, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
382 SetDParam(1, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
383 SetDParam(2, LOAN_INTERVAL);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
384 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
385
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
386 DrawCompanyEconomyStats(c, this->small, this->widget);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
387 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
388
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
389 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
390 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
391 switch (widget) {
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
392 case CFW_TOGGLE_SIZE: {// toggle size
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
393 bool new_mode = !this->small;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
394 bool stickied = !!(this->flags4 & WF_STICKY);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
395 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
396 int oldleft = this->left; ///< current left 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
397 CompanyID company = (CompanyID)this->window_number;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
398
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
399 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
400 /* Open up the (toggled size) Finance 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
401 DoShowCompanyFinances(company, new_mode, stickied, oldtop, oldleft);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
402 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
403 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
404
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
405 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
406 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
407 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
408
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
409 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
410 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
411 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
412 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
413 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
414 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
415
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
416 static const WindowDesc _company_finances_desc(
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
417 WDP_AUTO, WDP_AUTO, 407, 60, 407, 60,
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
418 WC_FINANCES, WC_NONE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
419 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
420 _company_finances_widgets, _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
421 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
422
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
423 static const WindowDesc _company_finances_small_desc(
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
424 WDP_AUTO, WDP_AUTO, 280, 60, 280, 60,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
425 WC_FINANCES, WC_NONE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
426 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
427 _company_finances_small_widgets, _nested_company_finances_small_widgets, lengthof(_nested_company_finances_small_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
428 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
429
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
430 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
431 * Open the small/large finance window of the company
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
432 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
433 * @param company the company who's finances are requested to be seen
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
434 * @param show_small show large or small version opf the window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
435 * @param show_stickied previous "stickyness" of the window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
436 * @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
437 * @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
438 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
439 * @pre is company a valid company
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
440 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
441 static void DoShowCompanyFinances(CompanyID company, bool show_small, bool show_stickied, int top, int left)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
442 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
443 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
444
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
445 if (BringWindowToFrontById(WC_FINANCES, company)) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
446 new CompanyFinancesWindow(show_small ? &_company_finances_small_desc : &_company_finances_desc, company, show_small, show_stickied, top, left);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
447 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
448
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
449 void ShowCompanyFinances(CompanyID company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
450 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
451 DoShowCompanyFinances(company, false, false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
452 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
453
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
454 /* 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
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463 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
464 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
465 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
466 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
467 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
468 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
469 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
470 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
471 STR_COLOUR_WHITE,
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
472 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
473
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
474 /* 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
475 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
476 LC_OTHER,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
477 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
478 LC_ROAD, LC_ROAD,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
479 LC_SHIP, LC_SHIP,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
480 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
481 LC_ROAD, LC_ROAD,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
482 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
483
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
484 class DropDownListColourItem : public DropDownListItem {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
485 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
486 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
487
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
488 virtual ~DropDownListColourItem() {}
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
489
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
490 StringID String() const
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
491 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
492 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
493 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
494
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
495 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
496 {
11516
8e9dee9357f7 (svn r15877) -Codechange: Let drop down lists know about font height.
peter1138 <peter1138@openttd.org>
parents: 11508
diff changeset
497 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
498 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
499
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
500 bool Selectable() const
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
501 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
502 return true;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
503 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
504
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
505 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
506 {
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
507 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
508 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
509 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
510 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
511
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
512 /** 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
513 enum SelectCompanyLiveryWindowWidgets {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
514 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
515 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
516 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
517 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
518 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
519 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
520 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
521 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
522 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
523 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
524 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
525 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
526 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
527
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
528 struct SelectCompanyLiveryWindow : public Window {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
529 private:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
530 uint32 sel;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
531 LiveryClass livery_class;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
532
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
533 void ShowColourDropDownMenu(uint32 widget)
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 uint32 used_colours = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
536 const Livery *livery;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
537 LiveryScheme scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
538
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
539 /* 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
540 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
541 const Company *c;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
542 FOR_ALL_COMPANIES(c) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
543 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
544 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
545 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
546
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
547 /* 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
548 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
549 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
550 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
551 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
552 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
553
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
554 DropDownList *list = new DropDownList();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
555 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
556 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
557 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
558
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
559 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
560 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
561
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
562 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
563 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
564 {
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
565 this->owner = company;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
566 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
567 this->sel = 1;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
568 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
569 this->OnInvalidateData();
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
570 this->FindWindowPlacementAndResize(desc);
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
573 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
574 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
575 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
576 LiveryScheme scheme = LS_DEFAULT;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
577 int y = 51;
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 /* 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
580 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
581 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
582
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
583 if (this->sel != 0) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
584 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
585 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
586 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
587 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
588 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
589
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
590 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
591 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
592
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
593 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
594
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
595 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
596 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
597 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
598
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
599 if (scheme != LS_DEFAULT) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
600 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
601 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
602
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
603 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
604
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
605 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
606 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
607
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
608 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
609 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
610 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
611 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
612
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
613 y += 14;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
614 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
615 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
616 }
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 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
619 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
620 /* 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
621 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
622 1,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
623 13,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
624 4,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
625 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
626 3,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
627 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
628
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
629 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
630 /* Livery Class buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
631 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
632 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
633 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
634 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
635 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
636 LiveryScheme scheme;
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 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
639 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
640 this->sel = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
641 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
642
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
643 /* 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
644 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
645 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
646 this->sel = 1 << scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
647 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
648 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
649 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
650 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
651 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
652 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
653 MarkWholeScreenDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
654 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
655 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
656
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
657 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
658 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
659 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
660
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
661 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
662 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
663 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
664
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
665 case SCLW_WIDGET_MATRIX: {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
666 LiveryScheme scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
667 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
668
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
669 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
670 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
671 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
672 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
673 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
674
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
675 /* 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
676 if (pt.x < 10) {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
677 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
678 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
679
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
680 if (_ctrl_pressed) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
681 ToggleBit(this->sel, j);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
682 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
683 this->sel = 1 << j;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
684 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
685 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
686 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
687 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
688 }
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
691 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
692 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
693 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
694 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
695 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
696 }
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 }
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 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
701 {
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
702 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
703 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
704 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
705 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
706 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
707 this->width = r + 1;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
708 }
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
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
711 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
712 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
713 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
714 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
715 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
716 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
717 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
718 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
719 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
720 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
721 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
722 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
723 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
724 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
725 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
726 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
727 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
728 EndContainer(),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
729 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
730 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
731
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
732 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
733 { 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
734 { 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
735 { 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
736 { 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
737 { 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
738 { 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
739 { 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
740 { 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
741 { 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
742 { 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
743 { 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
744 { 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
745 { WIDGETS_END },
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
746 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
747
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
748 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
749 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
750 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
751 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
752 _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
753 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
754
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
755 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
756 * 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
757 * @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
758 * @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
759 * @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
760 * @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
761 */
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
762 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
763 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
764 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
765
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
766 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
767 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
768 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
769 SpriteID pal;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
770
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
771 /* 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
772 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
773 pal = PAL_NONE;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
774 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
775 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
776 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
777 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
778 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
779 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
780 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
781 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
782
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
783 /* 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
784 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
785
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
786 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
787 switch (cmfv) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
788 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
789 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
790 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
791 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
792 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
793 default: break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
794 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
795 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
796 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
797 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
798
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
799 /**
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
800 * 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
801 * 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
802 * 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
803 */
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
804 enum SelectCompanyManagerFaceWidgets {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
805 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
806 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
807 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
808 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
809 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
810 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
811 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
812 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
813 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
814 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
815 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
816 /* 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
817 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
818 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
819 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
820 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
821 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
822 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
823 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
824 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
825 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
826 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
827 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
828 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
829 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
830 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
831 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
832 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
833 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
834 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
835 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
836 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
837 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
838 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
839 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
840 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
841 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
842 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
843 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
844 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
845 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
846 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
847 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
848 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
849 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
850 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
851 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
852 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
853 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
854 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
855 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
856
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
857 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
858 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
859 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
860 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
861 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
862 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
863 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
864 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
865 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
866 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
867 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
868 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
869 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
870 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
871 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
872 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
873 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
874 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
875 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
876 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
877 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
878 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
879 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
880 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
881 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
882 EndContainer(),
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),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
884 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
885 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
886 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
887 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
888
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
889 /** 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
890 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
891 { 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
892 { 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
893 { 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
894 { 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
895 { 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
896 { 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
897 { 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
898 { 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
899 { 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
900 { 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
901 { 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
902 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
903 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
904
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
905 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
906 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
907 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
908 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
909 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
910 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
911 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
912 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
913 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
914 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
915 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
916 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
917 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
918 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
919 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
920 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
921 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
922 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
923 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
924 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
925 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
926 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
927 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
928 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
929 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
930 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
931 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
932 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
933 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
934 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
935 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
936 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
937 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
938 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
939 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
940 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
941 EndContainer(),
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, 2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
943 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
944 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
945 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
946 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
947 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
948 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
949 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
950 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
951 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
952 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
953 EndContainer(),
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_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12517
diff changeset
955 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
956 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
957 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
958 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
959 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
960 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
961 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
962 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
963 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
964 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
965 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
966 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
967 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
968 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
969 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
970 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
971 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
972 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
973 EndContainer(),
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_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
976 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
977 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
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_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
981 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
982 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
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_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
986 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
987 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
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_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
991 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
992 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
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_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
996 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
997 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
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 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1000 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1001 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
1002 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1003 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
1004 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1005 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1006 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
1007 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
1008 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
1009 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1010 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1011
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1012 /** 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
1013 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
1014 { 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
1015 { 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
1016 { 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
1017 { 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
1018 { 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
1019 { 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
1020 { 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
1021 { 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
1022 { 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
1023 { 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
1024 { 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
1025 { 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
1026 { 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
1027 { 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
1028 { 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
1029 { 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
1030 { 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
1031 { 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
1032 { 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
1033 { 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
1034 { 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
1035 { 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
1036 { 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
1037 { 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
1038 { 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
1039 { 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
1040 { 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
1041 { 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
1042 { 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
1043 { 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
1044 { 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
1045 { 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
1046 { 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
1047 { 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
1048 { 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
1049 { 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
1050 { 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
1051 { 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
1052 { 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
1053 { 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
1054 { 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
1055 { 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
1056 { 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
1057 { 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
1058 { 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
1059 { 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
1060 { 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
1061 { 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
1062 { 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
1063 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1064 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1065
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1066 class SelectCompanyManagerFaceWindow : public Window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1067 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1068 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
1069 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
1070
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1071 GenderEthnicity ge;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1072 bool is_female;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1073 bool is_moust_male;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1074
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1075 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1076 * 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
1077 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1078 * @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
1079 * @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
1080 * @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
1081 * @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
1082 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1083 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
1084 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1085 /* 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
1086 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
1087
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1088 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
1089 if (is_bool_widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1090 /* 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
1091 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
1092 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1093 /* 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
1094 SetDParam(0, val + 1);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1095 str = STR_JUST_INT;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1096 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1097
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1098 /* 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
1099 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
1100 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
1101 }
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1104 void UpdateData()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1105 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1106 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
1107 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
1108 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
1109 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1110
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1111 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1112 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
1113 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1114 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
1115 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
1116 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
1117 this->advanced = advanced;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1118
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1119 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1120
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1121 /* 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
1122 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
1123 this->top = top;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1124 this->left = left;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1125 }
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 this->FindWindowPlacementAndResize(desc);
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1130 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1131 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1132 /* 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
1133 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
1134 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
1135
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1136 /* 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
1137 if (this->advanced) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1138 /* 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
1139 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
1140 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
1141
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1142
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1143 /* 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
1144 * (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
1145 * 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
1146
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1147 /* Eye colour buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1148 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
1149 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
1150
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1151 /* Chin buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1152 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
1153 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
1154
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1155 /* Eyebrows buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1156 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
1157 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
1158
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1159 /* 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
1160 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
1161 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
1162
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1163 /* 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
1164 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
1165 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
1166
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1167 /* Hair buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1168 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
1169 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
1170
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1171 /* Jacket buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1172 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
1173 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
1174
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1175 /* Collar buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1176 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
1177 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
1178
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1179 /* 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
1180 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
1181 (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
1182 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
1183
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1184 /* 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
1185 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
1186 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
1187 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1188
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1189 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1190
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1191 /* 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
1192 if (this->advanced) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1193 if (this->is_female) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1194 /* Only for female faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1195 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
1196 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
1197 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1198 /* Only for male faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1199 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
1200 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
1201 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1202 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
1203 /* 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
1204 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
1205 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1206 /* 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
1207 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
1208 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1209 /* For all faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1210 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
1211 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
1212 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
1213 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
1214 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
1215 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
1216 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
1217 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
1218 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
1219 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1220
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1221 /* 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
1222 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
1223 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1224
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1225 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
1226 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1227 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1228 /* 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
1229 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
1230 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
1231 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
1232
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1233 /* 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
1234 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
1235 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
1236 bool adv = !this->advanced;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1237 Window *parent = this->parent;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1238
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1239 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1240
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1241 /* 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
1242 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
1243 } break;
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 /* OK button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1247 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
1248 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
1249 /* Fall-Through */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1250
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1251 /* Cancel button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1252 case SCMFW_WIDGET_CANCEL:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1253 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1254 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1255
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1256 /* Load button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1257 case SCMFW_WIDGET_LOAD:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1258 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
1259 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1260 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
1261 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1262 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1263 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1264
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1265 /* '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
1266 case SCMFW_WIDGET_FACECODE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1267 SetDParam(0, this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1268 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
1269 break;
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 /* Save 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_SAVE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1273 _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
1274 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
1275 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1276
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1277 /* 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
1278 case SCMFW_WIDGET_MALE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1279 case SCMFW_WIDGET_FEMALE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1280 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
1281 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1282 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1283 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1284 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1285
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1286 /* Randomize face button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1287 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
1288 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
1289 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1290 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1291 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1292
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1293 /* 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
1294 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
1295 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
1296 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
1297 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1298 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1299 this->SetDirty();
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 default:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1303 /* 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
1304 * Therefor is this combined function.
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1305 * 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
1306 * a: invert the value for boolean variables
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1307 * 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
1308 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
1309 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
1310
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1311 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
1312 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
1313 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1314 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
1315 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
1316 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1317 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
1318 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1319 } else { // Value buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1320 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
1321 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1322 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
1323 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
1324 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
1325 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
1326 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
1327 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
1328 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
1329 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
1330 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
1331 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
1332 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1333 /* 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
1334 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
1335 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1336 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1337 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1338 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1339 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1340 }
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1343 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
1344 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1345 if (str == NULL) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1346 /* 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
1347 if (!StrEmpty(str)) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1348 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
1349 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1350 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
1351 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1352 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1353 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1354 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
1355 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1356 }
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1359 /** 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
1360 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
1361 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
1362 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
1363 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
1364 _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
1365 );
10208
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 /** 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
1368 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
1369 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
1370 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
1371 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
1372 _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
1373 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1374
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1375 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1376 * 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
1377 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1378 * @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
1379 * @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
1380 * @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
1381 * @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
1382 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1383 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
1384 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
1385 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
1386
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1387 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
1388 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
1389 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1390
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1391
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1392 /** 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
1393 enum CompanyWindowWidgets {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1394 CW_WIDGET_CLOSEBOX = 0,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1395 CW_WIDGET_CAPTION,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1396 CW_WIDGET_FACE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1397 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
1398 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
1399 CW_WIDGET_PRESIDENT_NAME,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1400 CW_WIDGET_COMPANY_NAME,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1401 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
1402 CW_WIDGET_RELOCATE_HQ,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1403 CW_WIDGET_BUY_SHARE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1404 CW_WIDGET_SELL_SHARE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1405 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
1406 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
1407 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1408
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1409 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
1410 { 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
1411 { 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
1412 { 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
1413 { 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
1414 { 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
1415 { 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
1416 { 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
1417 { 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
1418 { 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
1419 { 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
1420 { 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
1421 { 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
1422 { 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
1423 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1424 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1425
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1426 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
1427 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
1428 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
1429 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
1430 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1431 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
1432 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
1433 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
1434 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
1435 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
1436 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
1437 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1438 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
1439 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
1440 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
1441 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
1442 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
1443 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1444 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
1445 /* Multi player buttons. */
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1446 NWidget(NWID_SELECTION),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1447 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
1448 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
1449 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
1450 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
1451 EndContainer(),
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),
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
1453 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
1454 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
1455 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
1456 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1457 EndContainer(),
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_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
1459 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1460 /* Button bars at the bottom. */
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1461 NWidget(NWID_SELECTION),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1462 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
1463 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
1464 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
1465 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
1466 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
1467 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
1468 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
1469 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
1470 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
1471 EndContainer(),
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),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1473 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
1474 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
1475 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
1476 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
1477 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1478 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1479 };
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1480
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1481 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1482 * 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
1483 * @param company ID of company to print statistics of
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1484 */
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
1485 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
1486 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1487 const int x = 110;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1488 int y = 63;
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1489 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
1490
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1491 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
1492
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1493 const Vehicle *v;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1494 FOR_ALL_VEHICLES(v) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1495 if (v->owner == company) {
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1496 if (v->IsPrimaryVehicle()) {
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1497 assert((size_t)v->type < lengthof(amounts));
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1498 amounts[v->type]++;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1499 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1500 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1501 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1502
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1503 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
1504 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
1505 } else {
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1506 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
1507 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
1508 };
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1509 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
1510
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1511 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
1512 if (amounts[i] != 0) {
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1513 SetDParam(0, amounts[i]);
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1514 DrawString(x + 70, right, y, strings[i]);
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1515 y += 10;
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1516 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1517 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1518 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1519 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1520
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1521 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
1522 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1523 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
1524 (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
1525 (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
1526 (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
1527 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1528
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1529 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1530 * 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
1531 * @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
1532 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1533 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
1534 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1535 const Company *c2;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1536 uint num = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1537 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
1538
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1539 FOR_ALL_COMPANIES(c2) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1540 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
1541 if (amt != 0) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1542 SetDParam(0, amt * 25);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1543 SetDParam(1, c2->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1544
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1545 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
1546 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1547 }
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1550 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1551 * 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
1552 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1553 struct CompanyWindow : Window
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 CompanyWindowWidgets query_widget;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1556
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1557 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
1558 {
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
1559 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
1560 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1561 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1562
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1563 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1564 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1565 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
1566 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
1567
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1568 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
1569 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
1570 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
1571 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
1572 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
1573 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
1574 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
1575 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
1576 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
1577 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
1578 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
1579 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
1580 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
1581
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1582 if (!local) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1583 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
1584 /* 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
1585 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
1586 /* 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
1587 (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
1588 /* 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
1589 _local_company == COMPANY_SPECTATOR);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1590
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1591 /* 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
1592 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
1593 /* 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
1594 _local_company == COMPANY_SPECTATOR);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1595 } 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
1596 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
1597 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
1598 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1599 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1600
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1601 SetDParam(0, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1602 SetDParam(1, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1603
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1604 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1605
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
1606 #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
1607 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
1608 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
1609 }
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
1610 #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
1611
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1612 /* Company manager's face */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1613 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
1614
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1615 /* "xxx (Manager)" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1616 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
1617 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
1618
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1619 /* "Inaugurated:" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1620 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
1621 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
1622
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1623 /* "Colour scheme:" */
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1624 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
1625 /* 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
1626 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
1627
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1628 /* "Vehicles:" */
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
1629 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
1630
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1631 /* "Company value:" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1632 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
1633 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
1634
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1635 /* Shares list */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1636 DrawCompanyOwnerText(c);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1637 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1638
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1639 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
1640 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1641 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1642 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
1643
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
1644 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
1645 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
1646 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
1647 break;
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 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
1650 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
1651 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
1652 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
1653 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1654
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1655 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
1656 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
1657 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
1658 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
1659 break;
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 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
1662 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
1663 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
1664 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
1665 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
1666 SetTileSelectSize(2, 2);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1667 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
1668 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
1669 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1670 if (_ctrl_pressed) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1671 ShowExtraViewPortWindow(tile);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1672 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1673 ScrollMainWindowToTile(tile);
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 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1676 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1677 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1678
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1679 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
1680 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
1681 SetTileSelectSize(2, 2);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1682 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
1683 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
1684 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1685
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1686 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
1687 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
1688 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1689
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1690 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
1691 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
1692 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1693
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1694 #ifdef ENABLE_NETWORK
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1695 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
1696 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
1697 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
1698
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
1699 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
1700 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
1701 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
1702 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
1703 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
1704 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
1705 } 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
1706 /* 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
1707 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
1708 } 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
1709 /* 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
1710 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
1711 }
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
1712 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
1713 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1714 #endif /* ENABLE_NETWORK */
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 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1717
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1718 virtual void OnHundredthTick()
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 /* 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
1721 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1722 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1723
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1724 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
1725 {
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
1726 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
1727 ResetObjectToPlace();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1728 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
1729 this->RaiseButtons();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1730 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1731
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1732 virtual void OnPlaceObjectAbort()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1733 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1734 this->RaiseButtons();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1735 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1736
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1737 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
1738 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1739 if (str == NULL) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1740
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1741 switch (this->query_widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1742 default: NOT_REACHED();
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 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
1745 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
1746 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1747
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1748 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
1749 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
1750 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
1751
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
1752 #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
1753 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
1754 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
1755 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
1756 #endif /* ENABLE_NETWORK */
10208
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 }
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
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
1761 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
1762 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
1763 WC_COMPANY, WC_NONE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1764 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
1765 _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
1766 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1767
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1768 void ShowCompany(CompanyID company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1769 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
1770 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
1771
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1772 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
1773 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1774
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1775 /** widget numbers of the #BuyCompanyWindow. */
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1776 enum BuyCompanyWidgets {
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1777 BCW_CLOSEBOX,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1778 BCW_CAPTION,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1779 BCW_BACKGROUND,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1780 BCW_NO,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1781 BCW_YES,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1782 };
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 struct BuyCompanyWindow : Window {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1785 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
1786 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1787 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1788 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1789
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1790 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1791 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1792 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
1793 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
1794 SetDParam(1, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1795 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1796
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1797 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
1798
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1799 SetDParam(0, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1800 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
1801 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
1802 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1803
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1804 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
1805 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1806 switch (widget) {
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1807 case BCW_NO:
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1808 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1809 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1810
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1811 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
1812 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
1813 break;
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 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1817
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1818 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
1819 { 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
1820 { 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
1821 { 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
1822 { 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
1823 { 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
1824 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1825 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1826
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1827 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
1828 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
1829 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
1830 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
1831 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1832 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
1833 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
1834 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
1835 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
1836 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
1837 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
1838 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
1839 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
1840 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
1841 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
1842 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1843 };
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1844
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
1845 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
1846 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
1847 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
1848 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
1849 _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
1850 );
10208
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1853 void ShowBuyCompanyDialog(CompanyID company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1854 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1855 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
1856 }