src/viewport_type.h
author smatz
Sun, 17 Feb 2008 17:00:43 +0000
changeset 8586 cb0e7e00f1d2
parent 8225 cd84a95b6630
child 8857 7593af4962e6
permissions -rw-r--r--
(svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     2
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
     3
/** @file viewport_type.h Types related to viewports. */
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
     4
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
     5
#ifndef VIEWPORT_TYPE_H
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
     6
#define VIEWPORT_TYPE_H
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
8225
cd84a95b6630 (svn r11788) -Fix (11787): makedepend doesn't mark delete files as changed...
rubidium
parents: 8224
diff changeset
     8
#include "core/geometry_type.hpp"
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8121
diff changeset
     9
#include "zoom_type.h"
8106
e6790dd9e750 (svn r11667) -Codechange: split window.h into a header that defines some 'global' window related types, on that defined 'global' window functions and one that defines functions and types only used by *_gui.cpps.
rubidium
parents: 7918
diff changeset
    10
#include "window_type.h"
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    11
#include "tile_type.h"
6624
880e29b1f25e (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6423
diff changeset
    12
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
struct ViewPort {
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    14
	int left,top;                       // screen coordinates for the viewport
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    15
	int width, height;                  // screen width/height for the viewport
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    17
	int virtual_left, virtual_top;      // virtual coordinates
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    18
	int virtual_width, virtual_height;  // these are just width << zoom, height << zoom
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
6624
880e29b1f25e (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6423
diff changeset
    20
	ZoomLevel zoom;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
5044
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    23
enum {
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    24
	ZOOM_IN   = 0,
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    25
	ZOOM_OUT  = 1,
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    26
	ZOOM_NONE = 2, // hack, used to update the button status
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    27
};
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    28
7601
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    29
/**
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    30
 * Some values for constructing bounding boxes (BB). The Z positions under bridges are:
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    31
 * z=0..5  Everything that can be built under low bridges.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    32
 * z=6     reserved, currently unused.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    33
 * z=7     Z separator between bridge/tunnel and the things under/above it.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    34
 */
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    35
enum {
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    36
	BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    37
	BB_Z_SEPARATOR  = 7,        ///< Separates the bridge/tunnel from the things under/above it.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    38
};
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    39
7888
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    40
/** Viewport place method (type of highlighted area and placed objects) */
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    41
enum ViewportPlaceMethod {
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    42
	VPM_X_OR_Y          = 0, ///< drag in X or Y direction
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    43
	VPM_FIX_X           = 1, ///< drag only in X axis
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    44
	VPM_FIX_Y           = 2, ///< drag only in Y axis
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    45
	VPM_RAILDIRS        = 3, ///< all rail directions
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    46
	VPM_X_AND_Y         = 4, ///< area of land in X and Y directions
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    47
	VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    48
	VPM_SIGNALDIRS      = 6, ///< similiar to VMP_RAILDIRS, but with different cursor
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    49
};
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    50
7918
970e7c5005e5 (svn r11471) -Codechange: one more variable retyped to enum ViewportHighlightMode
smatz
parents: 7889
diff changeset
    51
/** Viewport highlight mode (for highlighting tiles below cursor) */
7889
e74ce8853ba7 (svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents: 7888
diff changeset
    52
enum ViewportHighlightMode {
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    53
	VHM_NONE    = 0, ///< default
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    54
	VHM_RECT    = 1, ///< rectangle (stations, depots, ...)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    55
	VHM_POINT   = 2, ///< point (lower land, raise land, level land, ...)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    56
	VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    57
	VHM_DRAG    = 4, ///< dragging items in the depot windows
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    58
	VHM_RAIL    = 5, ///< rail pieces
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    61
/* highlighting draw styles */
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    62
enum HighLightStyle {
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    63
	HT_NONE   = 0x00,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    64
	HT_RECT   = 0x80,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    65
	HT_POINT  = 0x40,
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    66
	HT_LINE   = 0x20,    ///< used for autorail highlighting (longer streches)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    67
	                     ///< (uses lower bits to indicate direction)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    68
	HT_RAIL   = 0x10,    ///< autorail (one piece)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    69
	                     ///< (uses lower bits to indicate direction)
4799
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
    70
	HT_DRAG_MASK = 0xF0, ///< masks the drag-type
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    71
1109
ecb98f43ba2c (svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents: 1093
diff changeset
    72
	/* lower bits (used with HT_LINE and HT_RAIL):
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    73
	 * (see ASCII art in autorail.h for a visual interpretation) */
4799
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
    74
	HT_DIR_X  = 0,    ///< X direction
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
    75
	HT_DIR_Y  = 1,    ///< Y direction
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
    76
	HT_DIR_HU = 2,    ///< horizontal upper
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
    77
	HT_DIR_HL = 3,    ///< horizontal lower
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
    78
	HT_DIR_VL = 4,    ///< vertical left
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
    79
	HT_DIR_VR = 5,    ///< vertical right
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
    80
	HT_DIR_MASK = 0x7 ///< masks the drag-direction
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
};
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    82
DECLARE_ENUM_AS_BIT_SET(HighLightStyle);
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
    83
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    85
struct TileHighlightData {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
	Point size;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
	Point outersize;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
	Point pos;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
	Point offs;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    90
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    91
	Point new_pos;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
	Point new_size;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
	Point new_outersize;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    94
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    95
	Point selend, selstart;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    96
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    97
	byte dirty;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
	byte sizelimit;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    99
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   100
	byte drawstyle;      // lower bits 0-3 are reserved for detailed highlight information information
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   101
	byte new_drawstyle;  // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   102
	byte next_drawstyle; // queued, but not yet drawn style
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   103
7918
970e7c5005e5 (svn r11471) -Codechange: one more variable retyped to enum ViewportHighlightMode
smatz
parents: 7889
diff changeset
   104
	ViewportHighlightMode place_mode;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   105
	bool make_square_red;
873
732553f5b169 (svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents: 849
diff changeset
   106
	WindowClass window_class;
732553f5b169 (svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents: 849
diff changeset
   107
	WindowNumber window_number;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   108
7888
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
   109
	ViewportPlaceMethod select_method;
6669
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6624
diff changeset
   110
	byte select_proc;
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6624
diff changeset
   111
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   112
	TileIndex redsq;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
   113
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   114
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8138
diff changeset
   115
#endif /* VIEWPORT_TYPE_H */