9574
|
1 |
/* $Id$ */
|
|
2 |
|
|
3 |
#include "stdafx.h"
|
|
4 |
#include "openttd.h"
|
|
5 |
#include "table/sprites.h"
|
|
6 |
#include "table/strings.h"
|
|
7 |
#include "functions.h"
|
|
8 |
#include "window.h"
|
|
9 |
#include "gui.h"
|
|
10 |
#include "viewport.h"
|
|
11 |
#include "gfx.h"
|
|
12 |
#include "sound.h"
|
|
13 |
#include "variables.h"
|
|
14 |
|
|
15 |
static void Transparent_Click(byte widget)
|
|
16 |
{
|
|
17 |
TOGGLEBIT(_transparent_opt, widget);
|
|
18 |
SndPlayFx(SND_15_BEEP);
|
|
19 |
}
|
|
20 |
|
|
21 |
static void TransparencyToolbWndProc(Window *w, WindowEvent *e)
|
|
22 |
{
|
|
23 |
switch (e->event) {
|
|
24 |
case WE_PAINT:
|
|
25 |
for (uint i = 0; i < 7; i++) {
|
|
26 |
SetWindowWidgetLoweredState(w, i + 3, HASBIT(_transparent_opt, i));
|
|
27 |
}
|
|
28 |
DrawWindowWidgets(w);
|
|
29 |
break;
|
|
30 |
|
|
31 |
case WE_CLICK:
|
|
32 |
if (e->we.click.widget >= 3) {
|
|
33 |
Transparent_Click(e->we.click.widget - 3);
|
|
34 |
MarkWholeScreenDirty();
|
|
35 |
}
|
|
36 |
break;
|
|
37 |
}
|
|
38 |
}
|
|
39 |
|
|
40 |
static const Widget _transparency_widgets[] = {
|
|
41 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
|
42 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 162, 0, 13, STR_TRANSPARENCY_TOOLB, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
|
43 |
{WWT_STICKYBOX, RESIZE_NONE, 7, 163, 174, 0, 13, STR_NULL, STR_STICKY_BUTTON},
|
|
44 |
|
|
45 |
/* transparency widgets: transparent signs, trees, houses, industries, player's buildings */
|
|
46 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_PLACE_SIGN, STR_TRANSPARENT_SIGNS_DESC},
|
|
47 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_PLANTTREES, STR_TRANSPARENT_TREES_DESC},
|
|
48 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 44, 65, 14, 35, SPR_IMG_TOWN, STR_TRANSPARENT_HOUSES_DESC},
|
|
49 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 66, 87, 14, 35, SPR_IMG_INDUSTRY, STR_TRANSPARENT_INDUSTRIES_DESC},
|
|
50 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_COMPANY_LIST, STR_TRANSPARENT_BUILDINGS_DESC},
|
|
51 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 110, 152, 14, 35, SPR_IMG_BRIDGE, STR_TRANSPARENT_BRIDGES_DESC},
|
|
52 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 153, 174, 14, 35, SPR_IMG_TRANSMITTER, STR_TRANSPARENT_STRUCTURES_DESC},
|
|
53 |
|
|
54 |
{ WIDGETS_END},
|
|
55 |
};
|
|
56 |
|
|
57 |
static const WindowDesc _transparency_desc = {
|
|
58 |
WDP_ALIGN_TBR, 58+36, 175, 36,
|
|
59 |
WC_TRANSPARENCY_TOOLBAR, WC_NONE,
|
|
60 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
|
|
61 |
_transparency_widgets,
|
|
62 |
TransparencyToolbWndProc
|
|
63 |
};
|
|
64 |
|
|
65 |
void ShowTransparencyToolbar(void)
|
|
66 |
{
|
|
67 |
AllocateWindowDescFront(&_transparency_desc, 0);
|
|
68 |
}
|