annotate src/company_gui.cpp @ 12411:9fdbb4594b82 draft

(svn r16845) -Codechange: Introduction of constants for describing the bits in a WWT_MATRIX data field.
author alberth <alberth@openttd.org>
date Thu, 16 Jul 2009 16:22:23 +0000
parents 4be044af31ec
children 4cdaa2d25b01
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
3 /** @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
4
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
5 #include "stdafx.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
6 #include "gui.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
7 #include "window_gui.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
8 #include "textbuf_gui.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
9 #include "viewport_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
10 #include "gfx_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
11 #include "company_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
12 #include "command_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
13 #include "network/network.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
14 #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
15 #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
16 #include "roadveh.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
17 #include "train.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
18 #include "aircraft.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
19 #include "newgrf.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
20 #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
21 #include "strings_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
22 #include "date_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
23 #include "string_func.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
24 #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
25 #include "tilehighlight_func.h"
10960
a4e5b5d2837c (svn r15299) -Cleanup: remove many redundant includes
smatz <smatz@openttd.org>
parents: 10912
diff changeset
26 #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
27
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
28 #include "table/strings.h"
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
29
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
30 enum {
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
31 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
32 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
33
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
34 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
35 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
36
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
37 /** 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
38 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
39 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
40 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
41 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
42 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
43 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
44 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
45 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
46 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
47 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
48 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
49 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
50 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
51 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
52 };
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
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 /** 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
55 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
56 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
57 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
58 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
59 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
60 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
61 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
62 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
63 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
64 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
65 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
66 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
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_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
69 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
70 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
71 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
72 };
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
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 /** 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
75 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
76 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
77 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
78 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
79
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
80 ExpensesList(ExpensesType *et, int length, int height) :
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
81 et(et),
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
82 length(length),
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
83 height(height)
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
84 {
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
85 }
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
86 };
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
87
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
88 static const ExpensesList _expenses_list_types[] = {
11897
b29337cb73a4 (svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents: 11818
diff changeset
89 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
90 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
91 };
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
92
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
93 /** 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
94 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108 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
109 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
110 };
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
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 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
113 {
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
114 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
115 int y;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
116 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
117 StringID str;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
118
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
119 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
120 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
121 /* 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
122 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
123
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
124 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
125 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
126 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
127 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
128 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
129 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
130 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
131 } else {
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
132 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
133 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
134 }
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 }
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
136
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
137 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
138
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
139 /* 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
140 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
141 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
142 w++;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
143 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
144
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
145 do {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
146 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
147 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
148 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
149
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
150 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
151 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
152
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
153 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
154
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
155 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
156 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
157 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
158
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 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
160 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
161 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
162 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
163 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
164 } 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
165 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
166 subtotal += cost;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
167 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
168 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
169
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
170 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
171 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
172 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
173 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
174 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
175 }
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
176 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
177 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
178
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
179 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
180 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
181 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
182 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
183
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
184 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
185 w++;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
186 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
187 year++;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
188 tbl--;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
189 } while (--j != 0);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
190
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
191 y += 14;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
192
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
193 /* 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
194 SetDParam(0, _economy.max_loan);
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
195 DrawString(widget[CFW_TOTAL_MAXLOAN].left, widget[CFW_TOTAL_MAXLOAN].right, y + 10, STR_MAX_LOAN);
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
196 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
197 y = 15;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
198 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
199
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
200 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
201 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
202 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
203
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
204 y += 10;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
205
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
206 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
207 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
208 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
209
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
210 y += 12;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
211
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
212 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
213
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
214 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
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
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
218 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
219 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
220 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
221 NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetMinimalSize(369, 14), SetDataTip(STR_FINANCES_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
222 NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetMinimalSize(14, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOGGLE_LARGE_SMALL_WINDOW),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
223 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
224 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
225 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
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_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
228 NWidget(NWID_SPACER), SetMinimalSize(7, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
229 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
230 NWidget(NWID_SPACER), SetMinimalSize(9, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
231 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
232 NWidget(NWID_SPACER), SetMinimalSize(9, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
233 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
234 NWidget(NWID_SPACER), SetMinimalSize(1, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
235 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
236 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
237 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
238 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
239 NWidget(NWID_SPACER), SetMinimalSize(2, 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_TOTAL_LABELS), SetMinimalSize(95, 34),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
241 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
242 NWidget(NWID_SPACER), SetMinimalSize(19, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
243 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
244 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
245 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
246 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
247 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
248 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
249 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
250 };
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
251
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
252 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
253 { 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
254 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 380, 0, 13, STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // CFW_CAPTION
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 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 381, 394, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_TOGGLE_LARGE_SMALL_WINDOW}, // CFW_TOGGLE_SIZE
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
256 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_GREY, 395, 406, 0, 13, 0x0, STR_STICKY_BUTTON}, // CFW_STICKY
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
257 { 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
258 { 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
259 { 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
260 { 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
261 { 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
262 { 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
263 { 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
264 { 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
265 { 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
266 { 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
267 { 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
268 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
269 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
270
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
271 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
272 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
273 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
274 NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetMinimalSize(243, 14), SetDataTip(STR_FINANCES_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
275 NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetMinimalSize(14, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOGGLE_LARGE_SMALL_WINDOW),
11504
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
276 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
277 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
278 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
279 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
280 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
281 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
282 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
283 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
284 NWidget(NWID_HORIZONTAL),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
285 NWidget(NWID_SPACER), SetMinimalSize(2, 0),
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_TOTAL_LABELS), SetMinimalSize(95, 34),
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_TOTAL_VALUES), SetMinimalSize(86, 34),
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_TOTAL_MAXLOAN), SetMinimalSize(97, 0),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
289 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
290 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
291 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
292 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
293 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
294 EndContainer(),
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
295 };
898be4863fa6 (svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents: 11503
diff changeset
296
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
297 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
298 { 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
299 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 253, 0, 13, STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // CFW_CAPTION
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 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 254, 267, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_TOGGLE_LARGE_SMALL_WINDOW}, // CFW_TOGGLE_SIZE
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
301 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_GREY, 268, 279, 0, 13, 0x0, STR_STICKY_BUTTON}, // CFW_STICKY
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
302 { 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
303 { 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
304 { 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
305 { 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
306 { 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
307 { 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
308 { 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
309 { 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
310 { 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
311 { 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
312 { 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
313 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
314 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
315
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
316 struct CompanyFinancesWindow : Window {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
317 bool small;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
318
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
319 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
320 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
321 Window(desc, company),
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
322 small(show_small)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
323 {
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
324 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
325
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
326 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
327
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
328 /* 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
329 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
330 this->top = top;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
331 this->left = left;
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
334 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
335 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
336
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
337 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
338 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
339 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
340 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
341
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
342 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
343 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
344 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
345 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
346 }
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
347 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
348 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
349 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
350 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
351 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
352 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
353 }
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
354 }
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
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
356 /* 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
357 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
358 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
359 /* 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
360 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
361 this->height = new_height;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
362 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
363
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 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
365 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
366 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
367
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
368 /* 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
369 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
370
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
371 /* 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
372 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
373
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
374 SetDParam(0, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
375 SetDParam(1, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
376 SetDParam(2, LOAN_INTERVAL);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
377 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
378
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
379 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
380 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
381
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
382 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
383 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
384 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
385 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
386 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
387 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
388 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
389 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
390 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
391
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
392 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
393 /* 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
394 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
395 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
396 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
397
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
398 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
399 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
400 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
401
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
402 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
403 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
404 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
405 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
406 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
407 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
408
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
409 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
410 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
411 WC_FINANCES, WC_NONE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
412 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
413 _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
414 );
10208
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_small_desc(
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
417 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
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_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
421 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
422
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
423 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
424 * 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
425 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
426 * @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
427 * @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
428 * @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
429 * @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
430 * @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
431 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
432 * @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
433 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
434 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
435 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
436 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
437
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
438 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
439 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
440 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
441
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
442 void ShowCompanyFinances(CompanyID company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
443 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
444 DoShowCompanyFinances(company, false, false);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
445 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
446
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
447 /* 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
448 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
449 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
450 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
451 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
452 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
453 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
454 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
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463 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
464 STR_COLOUR_WHITE,
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
465 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
466
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
467 /* 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
468 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
469 LC_OTHER,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
470 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
471 LC_ROAD, LC_ROAD,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
472 LC_SHIP, LC_SHIP,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
473 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
474 LC_ROAD, LC_ROAD,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
475 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
476
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
477 class DropDownListColourItem : public DropDownListItem {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
478 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
479 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
480
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
481 virtual ~DropDownListColourItem() {}
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 StringID String() const
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
484 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
485 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
486 }
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 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
489 {
11516
8e9dee9357f7 (svn r15877) -Codechange: Let drop down lists know about font height.
peter1138 <peter1138@openttd.org>
parents: 11508
diff changeset
490 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
491 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
492
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
493 bool Selectable() const
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 return true;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
496 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
497
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
498 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
499 {
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
500 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
501 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
502 }
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
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
505 /** 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
506 enum SelectCompanyLiveryWindowWidgets {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
507 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
508 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
509 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
510 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
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 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
519 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
520
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
521 struct SelectCompanyLiveryWindow : public Window {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
522 private:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
523 uint32 sel;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
524 LiveryClass livery_class;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
525
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
526 void ShowColourDropDownMenu(uint32 widget)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
527 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
528 uint32 used_colours = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
529 const Livery *livery;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
530 LiveryScheme scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
531
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
532 /* 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
533 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
534 const Company *c;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
535 FOR_ALL_COMPANIES(c) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
536 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
537 }
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
540 /* 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
541 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
542 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
543 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
544 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
545 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
546
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
547 DropDownList *list = new DropDownList();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
548 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
549 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
550 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
551
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
552 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
553 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
554
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
555 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
556 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
557 {
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
558 this->owner = company;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
559 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
560 this->sel = 1;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
561 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
562 this->OnInvalidateData();
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
563 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
564 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
565
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
566 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
567 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
568 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
569 LiveryScheme scheme = LS_DEFAULT;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
570 int y = 51;
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 /* 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
573 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
574 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
575
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
576 if (this->sel != 0) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
577 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
578 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
579 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
580 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
581 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
582
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
583 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
584 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
585
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
586 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
587
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
588 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
589 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
590 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
591
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
592 if (scheme != LS_DEFAULT) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
593 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
594 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
595
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
596 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
597
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
598 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
599 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
600
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
601 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
602 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
603 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
604 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
605
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
606 y += 14;
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 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
609 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
610
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
611 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
612 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
613 /* 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
614 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
615 1,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
616 13,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
617 4,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
618 2,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
619 3,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
620 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
621
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
622 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
623 /* Livery Class buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
624 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
625 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
626 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
627 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
628 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
629 LiveryScheme scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
630
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
631 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
632 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
633 this->sel = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
634 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
635
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
636 /* 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
637 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
638 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
639 this->sel = 1 << scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
640 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
641 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
642 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
643 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
644 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
645 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
646 MarkWholeScreenDirty();
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
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
650 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
651 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
652 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
653
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
654 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
655 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
656 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
657
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
658 case SCLW_WIDGET_MATRIX: {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
659 LiveryScheme scheme;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
660 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
661
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
662 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
663 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
664 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
665 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
666 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
667
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
668 /* 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
669 if (pt.x < 10) {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
670 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
671 }
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 (_ctrl_pressed) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
674 ToggleBit(this->sel, j);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
675 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
676 this->sel = 1 << j;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
677 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
678 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
679 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
680 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
681 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
682 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
683
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
684 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
685 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
686 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
687 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
688 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
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 }
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 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
694 {
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
695 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
696 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
697 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
698 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
699 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
700 this->width = r + 1;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
701 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
702 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
703
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
704 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
705 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
706 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
707 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
708 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
709 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
710 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_GENERAL), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
711 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_RAIL), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
712 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_ROAD), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRUCKLIST, STR_LIVERY_ROADVEH_TIP),
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_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_SHIP), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
714 NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_AIRCRAFT), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
715 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
716 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
717 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
718 NWidget(WWT_PANEL, COLOUR_GREY, SCLW_WIDGET_SPACER_DROPDOWN), SetMinimalSize(150, 12), EndContainer(),
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
719 NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_PRI_COL_DROPDOWN), SetMinimalSize(125, 12), SetDataTip(STR_BLACK_STRING, STR_LIVERY_PRIMARY_TIP),
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
720 NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_SEC_COL_DROPDOWN), SetMinimalSize(125, 12), SetDataTip(STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN, STR_LIVERY_SECONDARY_TIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
721 EndContainer(),
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
722 NWidget(WWT_MATRIX, COLOUR_GREY, SCLW_WIDGET_MATRIX), SetMinimalSize(400, 15), SetDataTip((1 << MAT_ROW_START) | (1 << MAT_COL_START), STR_LIVERY_PANEL_TIP),
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
723 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
724
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
725 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
726 { 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
727 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 399, 0, 13, STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS },
11086
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
728 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 21, 14, 35, SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TIP },
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
729 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 22, 43, 14, 35, SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TIP },
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
730 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 44, 65, 14, 35, SPR_IMG_TRUCKLIST, STR_LIVERY_ROADVEH_TIP },
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
731 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 66, 87, 14, 35, SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TIP },
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
732 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 88, 109, 14, 35, SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TIP },
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
733 { 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
734 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 149, 36, 47, 0x0, STR_NULL },
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
735 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_GREY, 150, 274, 36, 47, STR_BLACK_STRING, STR_LIVERY_PRIMARY_TIP },
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
736 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_GREY, 275, 399, 36, 47, STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN, STR_LIVERY_SECONDARY_TIP },
11086
23adfa4f7d5a (svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
737 { WWT_MATRIX, RESIZE_NONE, COLOUR_GREY, 0, 399, 48, 48 + 1 * 14, (1 << 8) | 1, STR_LIVERY_PANEL_TIP },
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
738 { WIDGETS_END },
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
739 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
740
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
741 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
742 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
743 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
744 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
745 _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
746 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
747
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
748 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
749 * 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
750 * @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
751 * @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
752 * @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
753 * @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
754 */
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
755 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
756 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
757 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
758
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
759 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
760 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
761 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
762 SpriteID pal;
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 /* 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
765 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
766 pal = PAL_NONE;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
767 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
768 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
769 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
770 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
771 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
772 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
773 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
774 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
775
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
776 /* 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
777 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
778
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
779 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
780 switch (cmfv) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
781 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
782 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
783 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
784 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
785 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
786 default: break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
787 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
788 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
789 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
790 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
791
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
792 /**
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
793 * 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
794 * 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
795 * 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
796 */
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
797 enum SelectCompanyManagerFaceWidgets {
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
798 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
799 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
800 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
801 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
802 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
803 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
804 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
805 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
806 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
807 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
808 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
809 /* 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
810 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
811 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
812 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
813 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
814 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
815 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
816 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
817 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
818 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
819 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
820 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
821 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
822 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
823 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
824 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
825 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
826 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
827 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
828 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
829 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
830 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
831 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
832 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
833 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
834 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
835 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
836 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
837 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
838 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
839 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
840 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
841 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
842 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
843 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
844 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
845 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
846 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
847 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
848 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
849
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
850 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
851 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
852 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
853 NWidget(WWT_CAPTION, COLOUR_GREY, SCMFW_WIDGET_CAPTION), SetMinimalSize(164, 14), SetDataTip(STR_FACE_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
854 NWidget(WWT_IMGBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL), SetMinimalSize(15, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
855 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
856 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
857 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
858 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
859 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
860 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
861 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
862 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
863 EndContainer(),
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_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
865 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
866 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
867 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON), SetMinimalSize(93, 12), SetDataTip(STR_FACE_ADVANCED, STR_FACE_ADVANCED_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
868 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
869 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
870 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
871 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
872 EndContainer(),
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(2, 0),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
874 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
875 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
876 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
877 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CANCEL), SetMinimalSize(95, 12), SetDataTip(STR_QUERY_CANCEL, STR_FACE_CANCEL_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
878 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_ACCEPT), SetMinimalSize(95, 12), SetDataTip(STR_QUERY_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
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 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
881
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
882 /** 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
883 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
884 { 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
885 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 174, 0, 13, STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // SCMFW_WIDGET_CAPTION
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
886 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 189, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL
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
887 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 189, 14, 150, 0x0, STR_NULL}, // SCMFW_WIDGET_SELECT_FACE
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
888 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 94, 151, 162, STR_QUERY_CANCEL, STR_FACE_CANCEL_TOOLTIP}, // SCMFW_WIDGET_CANCEL
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
889 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 189, 151, 162, STR_QUERY_OK, STR_FACE_OK_TOOLTIP}, // SCMFW_WIDGET_ACCEPT
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
890 { 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
891 { 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
892 { 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
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
893 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 187, 16, 27, STR_FACE_ADVANCED, STR_FACE_ADVANCED_TIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON
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_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
895 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
896 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
897
11508
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
898 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
899 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
900 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
901 NWidget(WWT_CAPTION, COLOUR_GREY, SCMFW_WIDGET_CAPTION), SetMinimalSize(194, 14), SetDataTip(STR_FACE_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
902 NWidget(WWT_IMGBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL), SetMinimalSize(15, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_FACE_SIMPLE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
903 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
904 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
905 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
906 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
907 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
908 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
909 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_RANDOM_NEW_FACE), SetMinimalSize(92, 12), SetDataTip(STR_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
910 NWidget(NWID_SPACER), SetMinimalSize(0, 9),
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_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_LOAD), SetMinimalSize(92, 12), SetDataTip(STR_FACE_LOAD, STR_FACE_LOAD_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
912 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_FACECODE), SetMinimalSize(92, 12), SetDataTip(STR_FACE_FACECODE, STR_FACE_FACECODE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
913 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_SAVE), SetMinimalSize(92, 12), SetDataTip(STR_FACE_SAVE, STR_FACE_SAVE_TIP),
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_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
915 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
916 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
917 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
918 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
919 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON), SetMinimalSize(123, 12), SetDataTip(STR_FACE_SIMPLE, STR_FACE_SIMPLE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
920 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
921 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
922 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
923 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
924 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
925 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
926 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
927 EndContainer(),
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_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
929 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
930 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
931 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
932 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
933 EndContainer(),
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),
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
937 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
938 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
939 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAS_MOUSTACHE_EARRING), SetMinimalSize(43, 12), SetDataTip(STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
940 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAS_GLASSES), SetMinimalSize(43, 12), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
941 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
942 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
943 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_HAIR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
944 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
945 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_HAIR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
946 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
947 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
948 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_EYEBROWS_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
949 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
950 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_EYEBROWS_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
951 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
952 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
953 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_EYECOLOUR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
954 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
955 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_EYECOLOUR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
956 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
957 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
958 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_GLASSES_TIP_2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
959 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TIP_2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
960 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_GLASSES_TIP_2),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
961 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
962 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
963 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_NOSE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
964 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
965 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_NOSE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
966 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
967 NWidget(NWID_HORIZONTAL),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
968 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_LIPS_MOUSTACHE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
969 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
970 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_LIPS_MOUSTACHE_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
971 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
972 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
973 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_CHIN_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
974 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
975 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_CHIN_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
976 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
977 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
978 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_JACKET_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
979 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
980 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_JACKET_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
981 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
982 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
983 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_COLLAR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
984 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
985 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_COLLAR_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
986 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
987 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
988 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING_L), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_LEFT, STR_FACE_TIE_EARRING_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
989 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING), SetMinimalSize(25, 12), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
990 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING_R), SetMinimalSize(9, 12), SetDataTip(SPR_ARROW_RIGHT, STR_FACE_TIE_EARRING_TIP),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
991 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
992 EndContainer(),
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_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
995 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
996 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
997 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
998 EndContainer(),
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
999 NWidget(NWID_HORIZONTAL),
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
1000 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CANCEL), SetMinimalSize(95, 12), SetDataTip(STR_QUERY_CANCEL, STR_FACE_CANCEL_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
1001 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_ACCEPT), SetMinimalSize(125, 12), SetDataTip(STR_QUERY_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
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 };
06e6021a10f2 (svn r15869) -Codechange: New widgets for select manager face and select livery windows
glx <glx@openttd.org>
parents: 11504
diff changeset
1004
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1005 /** 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
1006 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
1007 { 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
1008 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 204, 0, 13, STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // SCMFW_WIDGET_CAPTION
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1009 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 205, 219, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_FACE_SIMPLE_TIP}, // 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
1010 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 219, 14, 207, 0x0, STR_NULL}, // SCMFW_WIDGET_SELECT_FACE
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
1011 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 94, 208, 219, STR_QUERY_CANCEL, STR_FACE_CANCEL_TOOLTIP}, // SCMFW_WIDGET_CANCEL
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
1012 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 219, 208, 219, STR_QUERY_OK, STR_FACE_OK_TOOLTIP}, // SCMFW_WIDGET_ACCEPT
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
1013 { 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
1014 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 157, 217, 32, 43, 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
1015 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 137, 148, STR_RANDOM, STR_FACE_NEW_FACE_TOOLTIP}, // SCMFW_WIDGET_RANDOM_NEW_FACE
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1016 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 217, 16, 27, STR_FACE_SIMPLE, STR_FACE_SIMPLE_TIP}, // 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
1017 { 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
1018 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 158, 169, STR_FACE_LOAD, STR_FACE_LOAD_TIP}, // SCMFW_WIDGET_LOAD
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1019 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 170, 181, STR_FACE_FACECODE, STR_FACE_FACECODE_TIP}, // SCMFW_WIDGET_FACECODE
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1020 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 182, 193, STR_FACE_SAVE, STR_FACE_SAVE_TIP}, // SCMFW_WIDGET_SAVE
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1021 { 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
1022 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 157, 217, 46, 57, STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN}, // SCMFW_WIDGET_ETHNICITY_AFR
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1023 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 175, 217, 60, 71, STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TIP}, // 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
1024 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 175, 217, 72, 83, STR_EMPTY, STR_FACE_GLASSES_TIP}, // SCMFW_WIDGET_HAS_GLASSES
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
1025 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 110, 121, SPR_ARROW_LEFT, STR_FACE_EYECOLOUR_TIP}, // SCMFW_WIDGET_EYECOLOUR_L
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
1026 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 110, 121, STR_EMPTY, STR_FACE_EYECOLOUR_TIP}, // SCMFW_WIDGET_EYECOLOUR
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
1027 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 110, 121, SPR_ARROW_RIGHT, STR_FACE_EYECOLOUR_TIP}, // SCMFW_WIDGET_EYECOLOUR_R
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
1028 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 158, 169, SPR_ARROW_LEFT, STR_FACE_CHIN_TIP}, // SCMFW_WIDGET_CHIN_L
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
1029 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 158, 169, STR_EMPTY, STR_FACE_CHIN_TIP}, // SCMFW_WIDGET_CHIN
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
1030 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 158, 169, SPR_ARROW_RIGHT, STR_FACE_CHIN_TIP}, // SCMFW_WIDGET_CHIN_R
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
1031 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 98, 109, SPR_ARROW_LEFT, STR_FACE_EYEBROWS_TIP}, // SCMFW_WIDGET_EYEBROWS_L
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
1032 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 98, 109, STR_EMPTY, STR_FACE_EYEBROWS_TIP}, // SCMFW_WIDGET_EYEBROWS
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
1033 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 98, 109, SPR_ARROW_RIGHT, STR_FACE_EYEBROWS_TIP}, // SCMFW_WIDGET_EYEBROWS_R
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
1034 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 146, 157, SPR_ARROW_LEFT, STR_FACE_LIPS_MOUSTACHE_TIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE_L
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
1035 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 146, 157, STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE
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
1036 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 146, 157, SPR_ARROW_RIGHT, STR_FACE_LIPS_MOUSTACHE_TIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE_R
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
1037 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 134, 145, SPR_ARROW_LEFT, STR_FACE_NOSE_TIP}, // SCMFW_WIDGET_NOSE_L
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
1038 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 134, 145, STR_EMPTY, STR_FACE_NOSE_TIP}, // SCMFW_WIDGET_NOSE
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
1039 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 134, 145, SPR_ARROW_RIGHT, STR_FACE_NOSE_TIP}, // SCMFW_WIDGET_NOSE_R
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
1040 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 86, 97, SPR_ARROW_LEFT, STR_FACE_HAIR_TIP}, // SCMFW_WIDGET_HAIR_L
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
1041 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 86, 97, STR_EMPTY, STR_FACE_HAIR_TIP}, // SCMFW_WIDGET_HAIR
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
1042 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 86, 97, SPR_ARROW_RIGHT, STR_FACE_HAIR_TIP}, // SCMFW_WIDGET_HAIR_R
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
1043 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 170, 181, SPR_ARROW_LEFT, STR_FACE_JACKET_TIP}, // SCMFW_WIDGET_JACKET_L
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
1044 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 170, 181, STR_EMPTY, STR_FACE_JACKET_TIP}, // SCMFW_WIDGET_JACKET
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
1045 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 170, 181, SPR_ARROW_RIGHT, STR_FACE_JACKET_TIP}, // SCMFW_WIDGET_JACKET_R
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
1046 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 182, 193, SPR_ARROW_LEFT, STR_FACE_COLLAR_TIP}, // SCMFW_WIDGET_COLLAR_L
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
1047 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 182, 193, STR_EMPTY, STR_FACE_COLLAR_TIP}, // SCMFW_WIDGET_COLLAR
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
1048 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 182, 193, SPR_ARROW_RIGHT, STR_FACE_COLLAR_TIP}, // SCMFW_WIDGET_COLLAR_R
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
1049 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 194, 205, SPR_ARROW_LEFT, STR_FACE_TIE_EARRING_TIP}, // SCMFW_WIDGET_TIE_EARRING_L
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
1050 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 194, 205, STR_EMPTY, STR_FACE_TIE_EARRING_TIP}, // SCMFW_WIDGET_TIE_EARRING
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
1051 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 194, 205, SPR_ARROW_RIGHT, STR_FACE_TIE_EARRING_TIP}, // SCMFW_WIDGET_TIE_EARRING_R
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
1052 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 122, 133, SPR_ARROW_LEFT, STR_FACE_GLASSES_TIP_2}, // SCMFW_WIDGET_GLASSES_L
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
1053 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 122, 133, STR_EMPTY, STR_FACE_GLASSES_TIP_2}, // SCMFW_WIDGET_GLASSES
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
1054 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 122, 133, SPR_ARROW_RIGHT, STR_FACE_GLASSES_TIP_2}, // SCMFW_WIDGET_GLASSES_R
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
1055 { 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
1056 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1057 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1058
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1059 class SelectCompanyManagerFaceWindow : public Window
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1060 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1061 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
1062 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
1063
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1064 GenderEthnicity ge;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1065 bool is_female;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1066 bool is_moust_male;
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 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1069 * 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
1070 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1071 * @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
1072 * @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
1073 * @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
1074 * @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
1075 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1076 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
1077 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1078 /* 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
1079 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
1080
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1081 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
1082 if (is_bool_widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1083 /* 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
1084 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
1085 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1086 /* 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
1087 SetDParam(0, val + 1);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1088 str = STR_JUST_INT;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1089 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1090
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1091 /* 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
1092 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
1093 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
1094 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1095 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1096
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1097 void UpdateData()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1098 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1099 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
1100 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
1101 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
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 public:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1105 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
1106 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1107 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
1108 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
1109 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
1110 this->advanced = advanced;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1111
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1112 this->UpdateData();
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 /* 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
1115 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
1116 this->top = top;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1117 this->left = left;
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1120 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1121 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1122
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1123 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1124 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1125 /* 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
1126 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
1127 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
1128
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1129 /* 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
1130 if (this->advanced) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1131 /* 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
1132 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
1133 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
1134
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1135
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1136 /* 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
1137 * (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
1138 * 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
1139
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1140 /* Eye colour buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1141 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
1142 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
1143
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1144 /* Chin buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1145 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
1146 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
1147
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1148 /* Eyebrows buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1149 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
1150 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
1151
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1152 /* 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
1153 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
1154 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
1155
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1156 /* 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
1157 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
1158 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
1159
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1160 /* Hair buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1161 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
1162 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
1163
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1164 /* Jacket buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1165 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
1166 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
1167
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1168 /* Collar buttons */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1169 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
1170 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
1171
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1172 /* 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
1173 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
1174 (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
1175 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
1176
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1177 /* 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
1178 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
1179 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
1180 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1181
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1182 this->DrawWidgets();
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 /* 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
1185 if (this->advanced) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1186 if (this->is_female) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1187 /* Only for female faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1188 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
1189 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
1190 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1191 /* Only for male faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1192 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
1193 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
1194 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1195 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
1196 /* 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
1197 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
1198 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1199 /* 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
1200 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
1201 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1202 /* For all faces */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1203 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
1204 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
1205 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
1206 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
1207 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
1208 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
1209 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
1210 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
1211 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
1212 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1213
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1214 /* 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
1215 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
1216 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1217
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1218 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
1219 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1220 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1221 /* 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
1222 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
1223 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
1224 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
1225
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1226 /* 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
1227 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
1228 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
1229 bool adv = !this->advanced;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1230 Window *parent = this->parent;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1231
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1232 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1233
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1234 /* 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
1235 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
1236 } break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1237
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 /* OK button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1240 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
1241 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
1242 /* Fall-Through */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1243
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1244 /* Cancel button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1245 case SCMFW_WIDGET_CANCEL:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1246 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1247 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1248
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1249 /* Load button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1250 case SCMFW_WIDGET_LOAD:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1251 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
1252 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1253 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
1254 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1255 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1256 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1257
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1258 /* '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
1259 case SCMFW_WIDGET_FACECODE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1260 SetDParam(0, this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1261 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
1262 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1263
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1264 /* Save button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1265 case SCMFW_WIDGET_SAVE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1266 _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
1267 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
1268 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1269
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1270 /* 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
1271 case SCMFW_WIDGET_MALE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1272 case SCMFW_WIDGET_FEMALE:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1273 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
1274 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1275 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1276 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1277 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1278
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1279 /* Randomize face button */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1280 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
1281 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
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 /* 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
1287 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
1288 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
1289 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
1290 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1291 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1292 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1293 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1294
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1295 default:
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1296 /* 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
1297 * Therefor is this combined function.
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1298 * 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
1299 * a: invert the value for boolean variables
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11086
diff changeset
1300 * 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
1301 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
1302 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
1303
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1304 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
1305 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
1306 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1307 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
1308 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
1309 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1310 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
1311 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1312 } else { // Value buttons
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1313 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
1314 default: NOT_REACHED();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1315 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
1316 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
1317 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
1318 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
1319 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
1320 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
1321 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
1322 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
1323 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
1324 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
1325 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1326 /* 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
1327 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
1328 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1329 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1330 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1331 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1332 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1333 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1334 }
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 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
1337 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1338 if (str == NULL) return;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1339 /* 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
1340 if (!StrEmpty(str)) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1341 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
1342 ScaleAllCompanyManagerFaceBits(this->face);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1343 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
1344 this->UpdateData();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1345 this->SetDirty();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1346 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1347 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
1348 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1349 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1350 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1351
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1352 /** 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
1353 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
1354 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
1355 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
1356 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
1357 _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
1358 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1359
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1360 /** 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
1361 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
1362 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
1363 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
1364 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
1365 _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
1366 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1367
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1368 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1369 * 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
1370 *
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1371 * @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
1372 * @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
1373 * @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
1374 * @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
1375 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1376 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
1377 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
1378 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
1379
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1380 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
1381 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
1382 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1383
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1384
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1385 /** 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
1386 enum CompanyWindowWidgets {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1387 CW_WIDGET_CLOSEBOX = 0,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1388 CW_WIDGET_CAPTION,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1389 CW_WIDGET_FACE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1390 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
1391 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
1392 CW_WIDGET_PRESIDENT_NAME,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1393 CW_WIDGET_COMPANY_NAME,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1394 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
1395 CW_WIDGET_RELOCATE_HQ,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1396 CW_WIDGET_BUY_SHARE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1397 CW_WIDGET_SELL_SHARE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1398 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
1399 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
1400 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1401
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1402 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
1403 { 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
1404 { 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
1405 { 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
1406 { 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
1407 { 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
1408 { 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
1409 { 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
1410 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 18, 29, STR_COMPANY_VIEW_VIEW_HQ_BUTTON, STR_COMPANY_VIEW_BUILD_HQ_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
1411 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 32, 43, STR_RELOCATE_HQ, STR_RELOCATE_COMPANY_HEADQUARTERS},
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_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
1413 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 180, 359, 158, 169, STR_COMPANY_VIEW_SELL_SHARE_BUTTON, STR_COMPANY_VIEW_SELL_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
1414 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 138, 149, STR_COMPANY_PASSWORD, STR_COMPANY_PASSWORD_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, 266, 355, 138, 149, STR_COMPANY_JOIN, STR_COMPANY_JOIN_TIP},
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1416 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1417 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1418
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1419 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
1420 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
1421 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
1422 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
1423 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1424 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
1425 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
1426 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
1427 NWidget(NWID_SPACER), SetFill(1, 0),
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_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
1429 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
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(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
1432 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
1433 NWidget(NWID_SPACER), SetFill(1, 0),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1434 NWidget(WWT_TEXTBTN, COLOUR_GREY, CW_WIDGET_RELOCATE_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
1435 SetDataTip(STR_RELOCATE_HQ, STR_RELOCATE_COMPANY_HEADQUARTERS),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1436 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1437 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
1438 /* 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
1439 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
1440 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
1441 NWidget(NWID_SPACER), SetFill(1, 0),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1442 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_PASSWORD), 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
1443 SetDataTip(STR_COMPANY_PASSWORD, STR_COMPANY_PASSWORD_TOOLTIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1444 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1445 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
1446 NWidget(NWID_SPACER), SetFill(1, 0),
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(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_JOIN), 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
1448 SetDataTip(STR_COMPANY_JOIN, STR_COMPANY_JOIN_TIP),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1449 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1450 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1451 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
1452 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1453 /* 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
1454 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
1455 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
1456 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
1457 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
1458 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
1459 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
1460 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
1461 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
1462 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
1463 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
1464 EndContainer(),
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(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
1466 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
1467 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
1468 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
1469 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
1470 EndContainer(),
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 };
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1473
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1474 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1475 * 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
1476 * @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
1477 */
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
1478 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
1479 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1480 const int x = 110;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1481 int y = 63;
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1482 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
1483
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1484 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
1485
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1486 const Vehicle *v;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1487 FOR_ALL_VEHICLES(v) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1488 if (v->owner == company) {
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1489 if (v->IsPrimaryVehicle()) {
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1490 assert((size_t)v->type < lengthof(amounts));
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1491 amounts[v->type]++;
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1492 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1493 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1494 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1495
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1496 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
1497 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
1498 } else {
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1499 static const StringID strings[] = {
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1500 STR_TRAINS, STR_ROAD_VEHICLES, STR_SHIPS, STR_AIRCRAFT
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1501 };
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1502 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
1503
12299
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1504 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
1505 if (amounts[i] != 0) {
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1506 SetDParam(0, amounts[i]);
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1507 DrawString(x + 70, right, y, strings[i]);
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1508 y += 10;
3fdbdea15c58 (svn r16716) -Codechange: reduce code duplication in DrawCompanyVehiclesAmount()
smatz <smatz@openttd.org>
parents: 12143
diff changeset
1509 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1510 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1511 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1512 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1513
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1514 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
1515 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1516 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
1517 (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
1518 (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
1519 (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
1520 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1521
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 * 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
1524 * @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
1525 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1526 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
1527 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1528 const Company *c2;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1529 uint num = 0;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1530 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
1531
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1532 FOR_ALL_COMPANIES(c2) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1533 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
1534 if (amt != 0) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1535 SetDParam(0, amt * 25);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1536 SetDParam(1, c2->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1537
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1538 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
1539 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1540 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1541 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1542
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1543 /**
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1544 * 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
1545 */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1546 struct CompanyWindow : Window
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 CompanyWindowWidgets query_widget;
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 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
1551 {
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
1552 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
1553 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1554 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1555
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1556 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1557 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1558 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
1559 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
1560
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1561 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
1562 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
1563 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
1564 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
1565 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
1566 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
1567 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
1568 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
1569 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
1570 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
1571 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
1572 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
1573 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
1574
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1575 if (!local) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1576 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
1577 /* 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
1578 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
1579 /* 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
1580 (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
1581 /* 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
1582 _local_company == COMPANY_SPECTATOR);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1583
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1584 /* 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
1585 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
1586 /* 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
1587 _local_company == COMPANY_SPECTATOR);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1588 } 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
1589 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
1590 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
1591 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1592 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1593
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1594 SetDParam(0, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1595 SetDParam(1, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1596
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1597 this->DrawWidgets();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1598
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
1599 #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
1600 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
1601 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
1602 }
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
1603 #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
1604
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1605 /* Company manager's face */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1606 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
1607
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1608 /* "xxx (Manager)" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1609 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
1610 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
1611
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1612 /* "Inaugurated:" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1613 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
1614 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
1615
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1616 /* "Colour scheme:" */
11770
534c3c3167f2 (svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents: 11766
diff changeset
1617 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
1618 /* 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
1619 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
1620
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1621 /* "Vehicles:" */
11450
4557701373cc (svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents: 11445
diff changeset
1622 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
1623
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1624 /* "Company value:" */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1625 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
1626 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
1627
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1628 /* Shares list */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1629 DrawCompanyOwnerText(c);
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1632 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
1633 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1634 switch (widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1635 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
1636
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11084
diff changeset
1637 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
1638 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
1639 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
1640 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1641
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1642 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
1643 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
1644 SetDParam(0, this->window_number);
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
1645 ShowQueryString(STR_PRESIDENT_NAME, STR_QUERY_PRESIDENT_S_NAME_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
1646 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1647
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1648 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
1649 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
1650 SetDParam(0, this->window_number);
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
1651 ShowQueryString(STR_COMPANY_NAME, STR_QUERY_COMPANY_NAME_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
1652 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1653
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1654 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
1655 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
1656 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
1657 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
1658 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
1659 SetTileSelectSize(2, 2);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1660 this->LowerWidget(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
1661 this->InvalidateWidget(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
1662 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1663 if (_ctrl_pressed) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1664 ShowExtraViewPortWindow(tile);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1665 } else {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1666 ScrollMainWindowToTile(tile);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1667 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1668 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1669 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1670 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1671
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1672 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
1673 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
1674 SetTileSelectSize(2, 2);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1675 this->LowerWidget(CW_WIDGET_RELOCATE_HQ);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1676 this->InvalidateWidget(CW_WIDGET_RELOCATE_HQ);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1677 break;
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_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
1680 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
1681 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1682
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1683 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
1684 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
1685 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1686
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1687 #ifdef ENABLE_NETWORK
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1688 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
1689 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
1690 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
1691
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
1692 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
1693 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
1694 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
1695 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
1696 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
1697 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
1698 } 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
1699 /* 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
1700 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
1701 } 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
1702 /* 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
1703 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
1704 }
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 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
1706 }
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1707 #endif /* ENABLE_NETWORK */
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1708 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1709 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1710
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1711 virtual void OnHundredthTick()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1712 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1713 /* 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
1714 this->SetDirty();
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 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
1718 {
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
1719 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
1720 ResetObjectToPlace();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1721 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
1722 this->RaiseButtons();
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
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1725 virtual void OnPlaceObjectAbort()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1726 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1727 this->RaiseButtons();
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1728 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1729
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1730 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
1731 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1732 if (str == NULL) return;
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 switch (this->query_widget) {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1735 default: NOT_REACHED();
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 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
1738 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
1739 break;
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 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
1742 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
1743 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
1744
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
1745 #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
1746 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
1747 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
1748 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
1749 #endif /* ENABLE_NETWORK */
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1750 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1751 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1752 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1753
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
1754 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
1755 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
1756 WC_COMPANY, WC_NONE,
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1757 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
1758 _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
1759 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1760
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1761 void ShowCompany(CompanyID company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1762 {
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11922
diff changeset
1763 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
1764
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1765 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
1766 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1767
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1768 /** widget numbers of the #BuyCompanyWindow. */
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1769 enum BuyCompanyWidgets {
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1770 BCW_CLOSEBOX,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1771 BCW_CAPTION,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1772 BCW_BACKGROUND,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1773 BCW_NO,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1774 BCW_YES,
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1775 };
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1776
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1777 struct BuyCompanyWindow : Window {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1778 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
1779 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1780 this->FindWindowPlacementAndResize(desc);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1781 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1782
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1783 virtual void OnPaint()
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1784 {
11922
0a4b63f3f3c3 (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents: 11897
diff changeset
1785 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
1786 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
1787 SetDParam(1, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1788 this->DrawWidgets();
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 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
1791
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1792 SetDParam(0, c->index);
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1793 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
1794 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
1795 }
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 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
1798 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1799 switch (widget) {
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1800 case BCW_NO:
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1801 delete this;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1802 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1803
11817
23c59079c57e (svn r16207) -Codechange: Added and applied BuyCompanyWidgets enum.
alberth <alberth@openttd.org>
parents: 11770
diff changeset
1804 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
1805 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
1806 break;
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1807 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1808 }
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1809 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1810
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1811 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
1812 { 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
1813 { 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
1814 { WWT_PANEL, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 333, 14, 136, 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
1815 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 148, 207, 117, 128, STR_NO, 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
1816 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 218, 277, 117, 128, STR_YES, STR_NULL},
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1817 { WIDGETS_END},
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1818 };
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1819
11818
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1820 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
1821 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
1822 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
1823 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
1824 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1825 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, BCW_BACKGROUND),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1826 NWidget(NWID_SPACER), SetMinimalSize(334, 103), SetFill(1, 0),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1827 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
1828 NWidget(NWID_SPACER), SetMinimalSize(148, 0), SetFill(1, 0),
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_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_NO), SetMinimalSize(60, 12), SetDataTip(STR_NO, STR_NULL),
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(NWID_SPACER), SetMinimalSize(10, 0), SetFill(1, 0),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1831 NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_YES), SetMinimalSize(60, 12), SetDataTip(STR_YES, STR_NULL),
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(NWID_SPACER), SetMinimalSize(56, 0), SetFill(1, 0),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1833 EndContainer(),
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_SPACER), SetMinimalSize(0, 8), SetFill(1, 0),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1835 EndContainer(),
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1836 };
1ac324d7bf52 (svn r16208) -Codechange: Added nested widgets for the buy company and show company windows.
alberth <alberth@openttd.org>
parents: 11817
diff changeset
1837
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
1838 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
1839 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
1840 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
1841 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
1842 _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
1843 );
10208
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1844
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1845
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1846 void ShowBuyCompanyDialog(CompanyID company)
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1847 {
39cf8eebfda5 (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1848 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
1849 }