OpenTTD

viewport_type.h
Go to the documentation of this file.
1 /* $Id: viewport_type.h 27248 2015-04-25 11:58:19Z frosch $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef VIEWPORT_TYPE_H
13 #define VIEWPORT_TYPE_H
14
15 #include "zoom_type.h"
16 #include "strings_type.h"
17 #include "table/strings.h"
18
19 class LinkGraphOverlay;
20
24 struct ViewPort {
25 int left;
26 int top;
27 int width;
28 int height;
29
30 int virtual_left;
31 int virtual_top;
32 int virtual_width;
33 int virtual_height;
34
35 ZoomLevel zoom;
36 LinkGraphOverlay *overlay;
37 };
38
40 enum ViewportSignMargin {
41 VPSM_LEFT = 1,
42 VPSM_RIGHT = 1,
43 VPSM_TOP = 1,
44 VPSM_BOTTOM = 1,
45 };
46
48 struct ViewportSign {
49 int32 center;
50 int32 top;
51 uint16 width_normal;
52 uint16 width_small;
53
54 void UpdatePosition(int center, int top, StringID str, StringID str_small = STR_NULL);
55 void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
56 };
57
62 enum ZoomStateChange {
63 ZOOM_IN = 0,
64 ZOOM_OUT = 1,
65 ZOOM_NONE = 2,
66 };
67
74 static const uint BB_HEIGHT_UNDER_BRIDGE = 6;
75 static const uint BB_Z_SEPARATOR = 7;
76
78 enum ViewportPlaceMethod {
79 VPM_X_OR_Y = 0,
80 VPM_FIX_X = 1,
81 VPM_FIX_Y = 2,
82 VPM_X_AND_Y = 3,
83 VPM_X_AND_Y_LIMITED = 4,
84 VPM_FIX_HORIZONTAL = 5,
85 VPM_FIX_VERTICAL = 6,
86 VPM_X_LIMITED = 7,
87 VPM_Y_LIMITED = 8,
88 VPM_RAILDIRS = 0x40,
89 VPM_SIGNALDIRS = 0x80,
90 };
91 DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod)
92
93
97 enum ViewportDragDropSelectionProcess {
98 DDSP_DEMOLISH_AREA,
99 DDSP_RAISE_AND_LEVEL_AREA,
100 DDSP_LOWER_AND_LEVEL_AREA,
101 DDSP_LEVEL_AREA,
102 DDSP_CREATE_DESERT,
103 DDSP_CREATE_ROCKS,
104 DDSP_CREATE_WATER,
105 DDSP_CREATE_RIVER,
106 DDSP_PLANT_TREES,
107 DDSP_BUILD_BRIDGE,
108
109 /* Rail specific actions */
110 DDSP_PLACE_RAIL,
111 DDSP_BUILD_SIGNALS,
112 DDSP_BUILD_STATION,
113 DDSP_REMOVE_STATION,
114 DDSP_CONVERT_RAIL,
115
116 /* Road specific actions */
117 DDSP_PLACE_ROAD_X_DIR,
118 DDSP_PLACE_ROAD_Y_DIR,
119 DDSP_PLACE_AUTOROAD,
120 DDSP_BUILD_BUSSTOP,
121 DDSP_BUILD_TRUCKSTOP,
122 DDSP_REMOVE_BUSSTOP,
123 DDSP_REMOVE_TRUCKSTOP,
124 };
125
126 #endif /* VIEWPORT_TYPE_H */
ViewportDragDropSelectionProcess
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you&#39;ve selected it...
Definition: viewport_type.h:97
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:31
ViewPort::virtual_left
int virtual_left
Virtual left coordinate.
Definition: viewport_type.h:30
DDSP_BUILD_STATION
Station placement.
Definition: viewport_type.h:112
VPM_X_AND_Y_LIMITED
area of land of limited size
Definition: viewport_type.h:83
DDSP_RAISE_AND_LEVEL_AREA
Raise / level area.
Definition: viewport_type.h:99
DDSP_BUILD_TRUCKSTOP
Road stop placement (trucks)
Definition: viewport_type.h:121
ZOOM_OUT
Zoom out (get helicopter view).
Definition: viewport_type.h:64
ViewPort::height
int height
Screen height of the viewport.
Definition: viewport_type.h:28
DDSP_REMOVE_TRUCKSTOP
Road stop removal (trucks)
Definition: viewport_type.h:123
DDSP_LOWER_AND_LEVEL_AREA
Lower / level area.
Definition: viewport_type.h:100
VPM_FIX_X
drag only in X axis
Definition: viewport_type.h:80
BB_Z_SEPARATOR
static const uint BB_Z_SEPARATOR
Separates the bridge/tunnel from the things under/above it.
Definition: viewport_type.h:75
VPM_X_LIMITED
Drag only in X axis with limited size.
Definition: viewport_type.h:86
VPM_SIGNALDIRS
similar to VMP_RAILDIRS, but with different cursor
Definition: viewport_type.h:89
VPM_FIX_Y
drag only in Y axis
Definition: viewport_type.h:81
VPM_Y_LIMITED
Drag only in Y axis with limited size.
Definition: viewport_type.h:87
ViewPort::virtual_height
int virtual_height
height << zoom
Definition: viewport_type.h:33
ZOOM_IN
Zoom in (get more detailed view).
Definition: viewport_type.h:63
DDSP_REMOVE_BUSSTOP
Road stop removal (buses)
Definition: viewport_type.h:122
VPSM_LEFT
Left margin.
Definition: viewport_type.h:41
VPSM_RIGHT
Right margin.
Definition: viewport_type.h:42
zoom_type.h
Types related to zooming in and out.
DDSP_CREATE_ROCKS
Fill area with rocks.
Definition: viewport_type.h:103
DDSP_DEMOLISH_AREA
Clear area.
Definition: viewport_type.h:98
DDSP_PLACE_ROAD_X_DIR
Road placement (X axis)
Definition: viewport_type.h:117
ZOOM_LVL_MAX
Maximum zoom level.
Definition: zoom_type.h:48
DDSP_PLANT_TREES
Plant trees.
Definition: viewport_type.h:106
DDSP_BUILD_SIGNALS
Signal placement.
Definition: viewport_type.h:111
ViewportSign::top
int32 top
The top of the sign.
Definition: viewport_type.h:50
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:78
VPM_X_OR_Y
drag in X or Y direction
Definition: viewport_type.h:79
ViewportSign
Location information about a sign as seen on the viewport.
Definition: viewport_type.h:48
BB_HEIGHT_UNDER_BRIDGE
static const uint BB_HEIGHT_UNDER_BRIDGE
Some values for constructing bounding boxes (BB).
Definition: viewport_type.h:74
DDSP_BUILD_BUSSTOP
Road stop placement (buses)
Definition: viewport_type.h:120
DDSP_REMOVE_STATION
Station removal.
Definition: viewport_type.h:113
ViewportSign::width_normal
uint16 width_normal
The width when not zoomed out (normal font)
Definition: viewport_type.h:51
ViewPort::virtual_width
int virtual_width
width << zoom
Definition: viewport_type.h:32
DDSP_CREATE_RIVER
Create rivers.
Definition: viewport_type.h:105
DDSP_BUILD_BRIDGE
Bridge placement.
Definition: viewport_type.h:107
DDSP_CREATE_WATER
Create a canal.
Definition: viewport_type.h:104
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:18
VPM_FIX_HORIZONTAL
drag only in horizontal direction
Definition: viewport_type.h:84
DDSP_PLACE_AUTOROAD
Road placement (auto)
Definition: viewport_type.h:119
DDSP_PLACE_RAIL
Rail placement.
Definition: viewport_type.h:110
ViewportSign::center
int32 center
The center position of the sign.
Definition: viewport_type.h:49
ViewPort::left
int left
Screen coordinate left egde of the viewport.
Definition: viewport_type.h:25
ZoomLevel
ZoomLevel
All zoom levels we know.
Definition: zoom_type.h:21
DDSP_CREATE_DESERT
Fill area with desert.
Definition: viewport_type.h:102
VPM_X_AND_Y
area of land in X and Y directions
Definition: viewport_type.h:82
VPSM_BOTTOM
Bottom margin.
Definition: viewport_type.h:44
ViewPort
Data structure for viewport, display of a part of the world.
Definition: viewport_type.h:24
DDSP_CONVERT_RAIL
Rail conversion.
Definition: viewport_type.h:114
ViewportSignMargin
ViewportSignMargin
Margins for the viewport sign.
Definition: viewport_type.h:40
VPSM_TOP
Top margin.
Definition: viewport_type.h:43
strings_type.h
Types related to strings.
VPM_FIX_VERTICAL
drag only in vertical direction
Definition: viewport_type.h:85
DDSP_PLACE_ROAD_Y_DIR
Road placement (Y axis)
Definition: viewport_type.h:118
ViewPort::zoom
ZoomLevel zoom
The zoom level of the viewport.
Definition: viewport_type.h:35
ZoomStateChange
ZoomStateChange
Directions of zooming.
Definition: viewport_type.h:62
ViewPort::virtual_top
int virtual_top
Virtual top coordinate.
Definition: viewport_type.h:31
ViewportSign::width_small
uint16 width_small
The width when zoomed out (small font)
Definition: viewport_type.h:52
VPM_RAILDIRS
all rail directions
Definition: viewport_type.h:88
ViewPort::top
int top
Screen coordinate top edge of the viewport.
Definition: viewport_type.h:26
DDSP_LEVEL_AREA
Level area.
Definition: viewport_type.h:101
ZOOM_NONE
Hack, used to update the button status.
Definition: viewport_type.h:65
LinkGraphOverlay
Handles drawing of links into some window.
Definition: linkgraph_gui.h:38
ViewPort::width
int width
Screen width of the viewport.
Definition: viewport_type.h:27