Mercurial > hg > openttd
annotate src/transparency_gui.cpp @ 11637:c8133174cf71 draft
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
author | alberth <alberth@openttd.org> |
---|---|
date | Fri, 10 Apr 2009 16:31:29 +0000 |
parents | af4c3f370d2e |
children | a39da1e4c1f5 |
rev | line source |
---|---|
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
2 |
9111
d48433370037
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents:
8806
diff
changeset
|
3 /** @file transparency_gui.cpp The transparency GUI. */ |
d48433370037
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents:
8806
diff
changeset
|
4 |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
5 #include "stdafx.h" |
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
6 #include "openttd.h" |
8107
f65cf2bc3255
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents:
8106
diff
changeset
|
7 #include "window_gui.h" |
7849
e6ee8bfd9045
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas <belugas@openttd.org>
parents:
7341
diff
changeset
|
8 #include "transparency.h" |
8157
019833e42fda
(svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium <rubidium@openttd.org>
parents:
8131
diff
changeset
|
9 #include "sound_func.h" |
7849
e6ee8bfd9045
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas <belugas@openttd.org>
parents:
7341
diff
changeset
|
10 |
8264
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8224
diff
changeset
|
11 #include "table/sprites.h" |
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8224
diff
changeset
|
12 #include "table/strings.h" |
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8224
diff
changeset
|
13 |
7849
e6ee8bfd9045
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas <belugas@openttd.org>
parents:
7341
diff
changeset
|
14 TransparencyOptionBits _transparency_opt; |
8527
0ab483c54082
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros <maedhros@openttd.org>
parents:
8452
diff
changeset
|
15 TransparencyOptionBits _transparency_lock; |
8806
104bbcae351d
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz <smatz@openttd.org>
parents:
8657
diff
changeset
|
16 TransparencyOptionBits _invisibility_opt; |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
17 |
11636
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
18 /** Widget numbers of the transparency window. */ |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
19 enum TransparencyToolbarWidgets { |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
20 TTW_WIDGET_CLOSEBOX, ///< Closebox |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
21 TTW_WIDGET_CAPTION, ///< Titlebar caption |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
22 TTW_WIDGET_STICKYBOX, ///< Stickybox |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
23 TTW_WIDGET_SIGNS, ///< Make signs background transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
24 TTW_WIDGET_TREES, ///< Make trees transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
25 TTW_WIDGET_HOUSES, ///< Make houses transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
26 TTW_WIDGET_INDUSTRIES, ///< Make Industries transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
27 TTW_WIDGET_BUILDINGS, ///< Make company buildings and structures transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
28 TTW_WIDGET_BRIDGES, ///< Make bridges transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
29 TTW_WIDGET_STRUCTURES, ///< Make unmovable structures transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
30 TTW_WIDGET_CATENARY, ///< Make catenary transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
31 TTW_WIDGET_LOADING, ///< Make loading indicators transparent |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
32 TTW_WIDGET_END, ///< End of toggle buttons |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
33 |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
34 /* Panel with buttons for invisibility */ |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
35 TTW_BUTTONS = 12, ///< Panel with 'invisibility' buttons |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
36 }; |
af4c3f370d2e
(svn r16016) -Codechange: Moving the TransparencyToolbarWidgets outside the window class.
alberth <alberth@openttd.org>
parents:
11635
diff
changeset
|
37 |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
38 class TransparenciesWindow : public Window |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
39 { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
40 public: |
9203
375bae14ff71
(svn r13069) -Codechange: it is no longer needed to pass a void *data pointer with the WE_CREATE message because nothing uses it anymore.
rubidium <rubidium@openttd.org>
parents:
9197
diff
changeset
|
41 TransparenciesWindow(const WindowDesc *desc, int window_number) : Window(desc, window_number) |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
42 { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
43 this->FindWindowPlacementAndResize(desc); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
44 } |
6496
af3092f47536
(svn r9679) -Codechange: use enums to identify transparency widgets and add a bit of documentation (patch by Wolf01)
belugas <belugas@openttd.org>
parents:
6427
diff
changeset
|
45 |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
46 virtual void OnPaint() |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
47 { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
48 /* must be sure that the widgets show the transparency variable changes |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
49 * also when we use shortcuts */ |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
50 for (uint i = TTW_WIDGET_SIGNS; i < TTW_WIDGET_END; i++) { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
51 this->SetWidgetLoweredState(i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_SIGNS))); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
52 } |
8448
5b5fdcb49728
(svn r12018) -Fix(FS#1721,r9563): Restore initial intent on the invisible tree while transparent building patch setting
belugas <belugas@openttd.org>
parents:
8264
diff
changeset
|
53 |
9273
72a6d2e60834
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents:
9203
diff
changeset
|
54 this->DrawWidgets(); |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
55 for (uint i = TO_SIGNS; i < TO_END; i++) { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
56 if (HasBit(_transparency_lock, i)) DrawSprite(SPR_LOCK, PAL_NONE, this->widget[TTW_WIDGET_SIGNS + i].left + 1, this->widget[TTW_WIDGET_SIGNS + i].top + 1); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
57 } |
8806
104bbcae351d
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz <smatz@openttd.org>
parents:
8657
diff
changeset
|
58 |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
59 /* Do not draw button for invisible loading indicators */ |
9754
110a83853eca
(svn r13890) -Codechange: Simplify drawing of invisibilty buttons in the transparency gui -- the real widgets above already have coordinates so there is no need to hardcode them again. As an added bonus the invisibility buttons now line up properly.
peter1138 <peter1138@openttd.org>
parents:
9753
diff
changeset
|
60 for (uint i = TTW_WIDGET_SIGNS; i <= TTW_WIDGET_CATENARY; i++) { |
110a83853eca
(svn r13890) -Codechange: Simplify drawing of invisibilty buttons in the transparency gui -- the real widgets above already have coordinates so there is no need to hardcode them again. As an added bonus the invisibility buttons now line up properly.
peter1138 <peter1138@openttd.org>
parents:
9753
diff
changeset
|
61 const Widget *wi = &this->widget[i]; |
110a83853eca
(svn r13890) -Codechange: Simplify drawing of invisibilty buttons in the transparency gui -- the real widgets above already have coordinates so there is no need to hardcode them again. As an added bonus the invisibility buttons now line up properly.
peter1138 <peter1138@openttd.org>
parents:
9753
diff
changeset
|
62 DrawFrameRect(wi->left + 1, 38, wi->right - 1, 46, COLOUR_PALE_GREEN, HasBit(_invisibility_opt, i - TTW_WIDGET_SIGNS) ? FR_LOWERED : FR_NONE); |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
63 } |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
64 } |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
65 |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
66 virtual void OnClick(Point pt, int widget) |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
67 { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
68 if (widget >= TTW_WIDGET_SIGNS && widget < TTW_WIDGET_END) { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
69 if (_ctrl_pressed) { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
70 /* toggle the bit of the transparencies lock variable */ |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
71 ToggleTransparencyLock((TransparencyOption)(widget - TTW_WIDGET_SIGNS)); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
72 this->SetDirty(); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
73 } else { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
74 /* toggle the bit of the transparencies variable and play a sound */ |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
75 ToggleTransparency((TransparencyOption)(widget - TTW_WIDGET_SIGNS)); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
76 SndPlayFx(SND_15_BEEP); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
77 MarkWholeScreenDirty(); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
78 } |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
79 } else if (widget == TTW_BUTTONS) { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
80 uint x = pt.x / 22; |
8806
104bbcae351d
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz <smatz@openttd.org>
parents:
8657
diff
changeset
|
81 |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
82 if (x > TTW_WIDGET_BRIDGES - TTW_WIDGET_SIGNS) x--; |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
83 if (x > TTW_WIDGET_CATENARY - TTW_WIDGET_SIGNS) return; |
8806
104bbcae351d
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz <smatz@openttd.org>
parents:
8657
diff
changeset
|
84 |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
85 ToggleInvisibility((TransparencyOption)x); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
86 SndPlayFx(SND_15_BEEP); |
8806
104bbcae351d
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz <smatz@openttd.org>
parents:
8657
diff
changeset
|
87 |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
88 /* Redraw whole screen only if transparency is set */ |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
89 if (IsTransparencySet((TransparencyOption)x)) { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
90 MarkWholeScreenDirty(); |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
91 } else { |
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
92 this->InvalidateWidget(TTW_BUTTONS); |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
93 } |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
94 } |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
95 } |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
96 }; |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
97 |
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
98 static const Widget _transparency_widgets[] = { |
9753
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
99 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
100 { WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 206, 0, 13, STR_TRANSPARENCY_TOOLB, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
101 {WWT_STICKYBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 207, 218, 0, 13, STR_NULL, STR_STICKY_BUTTON}, |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
102 |
6496
af3092f47536
(svn r9679) -Codechange: use enums to identify transparency widgets and add a bit of documentation (patch by Wolf01)
belugas <belugas@openttd.org>
parents:
6427
diff
changeset
|
103 /* transparency widgets: |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10205
diff
changeset
|
104 * transparent signs, trees, houses, industries, company's buildings, bridges, unmovable structures, catenary and loading indicators */ |
9753
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
105 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 21, 14, 35, SPR_IMG_SIGN, STR_TRANSPARENT_SIGNS_DESC}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
106 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 22, 43, 14, 35, SPR_IMG_PLANTTREES, STR_TRANSPARENT_TREES_DESC}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
107 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 44, 65, 14, 35, SPR_IMG_TOWN, STR_TRANSPARENT_HOUSES_DESC}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
108 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 66, 87, 14, 35, SPR_IMG_INDUSTRY, STR_TRANSPARENT_INDUSTRIES_DESC}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
109 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 88, 109, 14, 35, SPR_IMG_COMPANY_LIST, STR_TRANSPARENT_BUILDINGS_DESC}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
110 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 110, 152, 14, 35, SPR_IMG_BRIDGE, STR_TRANSPARENT_BRIDGES_DESC}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
111 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 153, 174, 14, 35, SPR_IMG_TRANSMITTER, STR_TRANSPARENT_STRUCTURES_DESC}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
112 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 175, 196, 14, 35, SPR_BUILD_X_ELRAIL, STR_TRANSPARENT_CATENARY_DESC}, |
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
113 { WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 197, 218, 14, 35, SPR_IMG_TRAINLIST, STR_TRANSPARENT_LOADING_DESC}, |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
114 |
9753
db6b861a9f8a
(svn r13889) -Codechange: Replace numbers with Colours enum on transparency gui.
belugas <belugas@openttd.org>
parents:
9317
diff
changeset
|
115 { WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 218, 36, 48, 0x0, STR_TRANSPARENT_INVISIBLE_DESC}, |
8806
104bbcae351d
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz <smatz@openttd.org>
parents:
8657
diff
changeset
|
116 |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
117 { WIDGETS_END}, |
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
118 }; |
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
119 |
11637
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
120 static const NWidgetPart _nested_transparency_widgets[] = { |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
121 NWidget(NWID_HORIZONTAL), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
122 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, TTW_WIDGET_CLOSEBOX), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
123 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, TTW_WIDGET_CAPTION), SetDataTip(STR_TRANSPARENCY_TOOLB, STR_018C_WINDOW_TITLE_DRAG_THIS), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
124 NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN, TTW_WIDGET_STICKYBOX), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
125 EndContainer(), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
126 NWidget(NWID_HORIZONTAL), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
127 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_SIGNS), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SIGN, STR_TRANSPARENT_SIGNS_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
128 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_TREES), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_PLANTTREES, STR_TRANSPARENT_TREES_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
129 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_HOUSES), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TOWN, STR_TRANSPARENT_HOUSES_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
130 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_INDUSTRIES), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_INDUSTRY, STR_TRANSPARENT_INDUSTRIES_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
131 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_BUILDINGS), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_COMPANY_LIST, STR_TRANSPARENT_BUILDINGS_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
132 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_BRIDGES), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_TRANSPARENT_BRIDGES_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
133 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_STRUCTURES), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRANSMITTER, STR_TRANSPARENT_STRUCTURES_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
134 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_CATENARY), SetMinimalSize(22, 22), SetDataTip(SPR_BUILD_X_ELRAIL, STR_TRANSPARENT_CATENARY_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
135 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_WIDGET_LOADING), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAINLIST, STR_TRANSPARENT_LOADING_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
136 EndContainer(), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
137 /* Panel with 'inivisibility' buttons. */ |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
138 NWidget(WWT_PANEL, COLOUR_DARK_GREEN, TTW_WIDGET_END), SetMinimalSize(219, 13), SetDataTip(0x0, STR_TRANSPARENT_INVISIBLE_DESC), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
139 EndContainer(), |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
140 }; |
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
141 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
10960
diff
changeset
|
142 static const WindowDesc _transparency_desc( |
10205
8d0da62cf673
(svn r14419) -Codechange: adding two digits for no obvious reason (nor comment), plus code style Infringement.
belugas <belugas@openttd.org>
parents:
9754
diff
changeset
|
143 WDP_ALIGN_TBR, 94, 219, 49, 219, 49, |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
144 WC_TRANSPARENCY_TOOLBAR, WC_NONE, |
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
145 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
11637
c8133174cf71
(svn r16017) -Codechange: Added nested widgets to transparency settings window.
alberth <alberth@openttd.org>
parents:
11636
diff
changeset
|
146 _transparency_widgets, _nested_transparency_widgets, lengthof(_nested_transparency_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
10960
diff
changeset
|
147 ); |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
148 |
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
149 void ShowTransparencyToolbar(void) |
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
150 { |
9196
7f58b98c86c5
(svn r13062) -Codechange: make a class of the TransparencyToolbar.
belugas <belugas@openttd.org>
parents:
9143
diff
changeset
|
151 AllocateWindowDescFront<TransparenciesWindow>(&_transparency_desc, 0); |
6427
2437ed7b277c
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
peter1138 <peter1138@openttd.org>
parents:
diff
changeset
|
152 } |