2005-07-24 16:12:37 +02:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-01-09 10:45:45 +01:00
|
|
|
/** @file viewport_type.h Types related to viewports. */
|
2007-04-04 06:08:47 +02:00
|
|
|
|
2008-01-09 10:45:45 +01:00
|
|
|
#ifndef VIEWPORT_TYPE_H
|
|
|
|
#define VIEWPORT_TYPE_H
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2008-01-09 10:57:48 +01:00
|
|
|
#include "core/geometry_type.hpp"
|
2007-12-23 11:56:02 +01:00
|
|
|
#include "zoom_type.h"
|
2007-12-19 20:44:29 +01:00
|
|
|
#include "window_type.h"
|
2008-01-09 10:45:45 +01:00
|
|
|
#include "tile_type.h"
|
2007-05-15 16:08:39 +02:00
|
|
|
|
2004-08-09 19:04:08 +02:00
|
|
|
struct ViewPort {
|
2006-08-22 16:38:37 +02:00
|
|
|
int left,top; // screen coordinates for the viewport
|
|
|
|
int width, height; // screen width/height for the viewport
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2006-08-22 16:38:37 +02:00
|
|
|
int virtual_left, virtual_top; // virtual coordinates
|
|
|
|
int virtual_width, virtual_height; // these are just width << zoom, height << zoom
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2007-05-15 16:08:39 +02:00
|
|
|
ZoomLevel zoom;
|
2004-08-09 19:04:08 +02:00
|
|
|
};
|
|
|
|
|
2006-11-07 14:01:36 +01:00
|
|
|
enum {
|
|
|
|
ZOOM_IN = 0,
|
|
|
|
ZOOM_OUT = 1,
|
|
|
|
ZOOM_NONE = 2, // hack, used to update the button status
|
|
|
|
};
|
|
|
|
|
2007-09-19 18:36:42 +02:00
|
|
|
/**
|
|
|
|
* Some values for constructing bounding boxes (BB). The Z positions under bridges are:
|
|
|
|
* z=0..5 Everything that can be built under low bridges.
|
|
|
|
* z=6 reserved, currently unused.
|
|
|
|
* z=7 Z separator between bridge/tunnel and the things under/above it.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height.
|
|
|
|
BB_Z_SEPARATOR = 7, ///< Separates the bridge/tunnel from the things under/above it.
|
|
|
|
};
|
|
|
|
|
2007-11-15 19:21:59 +01:00
|
|
|
/** Viewport place method (type of highlighted area and placed objects) */
|
|
|
|
enum ViewportPlaceMethod {
|
|
|
|
VPM_X_OR_Y = 0, ///< drag in X or Y direction
|
|
|
|
VPM_FIX_X = 1, ///< drag only in X axis
|
|
|
|
VPM_FIX_Y = 2, ///< drag only in Y axis
|
|
|
|
VPM_RAILDIRS = 3, ///< all rail directions
|
|
|
|
VPM_X_AND_Y = 4, ///< area of land in X and Y directions
|
|
|
|
VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size
|
|
|
|
VPM_SIGNALDIRS = 6, ///< similiar to VMP_RAILDIRS, but with different cursor
|
2005-01-19 21:55:23 +01:00
|
|
|
};
|
|
|
|
|
2007-11-19 00:13:53 +01:00
|
|
|
/** Viewport highlight mode (for highlighting tiles below cursor) */
|
2007-11-15 19:28:00 +01:00
|
|
|
enum ViewportHighlightMode {
|
2007-04-04 06:08:47 +02:00
|
|
|
VHM_NONE = 0, ///< default
|
|
|
|
VHM_RECT = 1, ///< rectangle (stations, depots, ...)
|
|
|
|
VHM_POINT = 2, ///< point (lower land, raise land, level land, ...)
|
|
|
|
VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks)
|
|
|
|
VHM_DRAG = 4, ///< dragging items in the depot windows
|
|
|
|
VHM_RAIL = 5, ///< rail pieces
|
2004-08-09 19:04:08 +02:00
|
|
|
};
|
|
|
|
|
2007-04-04 06:08:47 +02:00
|
|
|
/* highlighting draw styles */
|
2008-01-09 10:45:45 +01:00
|
|
|
enum HighLightStyle {
|
2006-08-22 16:38:37 +02:00
|
|
|
HT_NONE = 0x00,
|
|
|
|
HT_RECT = 0x80,
|
|
|
|
HT_POINT = 0x40,
|
2007-04-04 06:08:47 +02:00
|
|
|
HT_LINE = 0x20, ///< used for autorail highlighting (longer streches)
|
|
|
|
///< (uses lower bits to indicate direction)
|
|
|
|
HT_RAIL = 0x10, ///< autorail (one piece)
|
|
|
|
///< (uses lower bits to indicate direction)
|
2006-10-10 16:05:39 +02:00
|
|
|
HT_DRAG_MASK = 0xF0, ///< masks the drag-type
|
2005-01-19 21:55:23 +01:00
|
|
|
|
2005-01-23 14:09:35 +01:00
|
|
|
/* lower bits (used with HT_LINE and HT_RAIL):
|
2005-01-19 21:55:23 +01:00
|
|
|
* (see ASCII art in autorail.h for a visual interpretation) */
|
2006-10-10 16:05:39 +02:00
|
|
|
HT_DIR_X = 0, ///< X direction
|
|
|
|
HT_DIR_Y = 1, ///< Y direction
|
|
|
|
HT_DIR_HU = 2, ///< horizontal upper
|
|
|
|
HT_DIR_HL = 3, ///< horizontal lower
|
|
|
|
HT_DIR_VL = 4, ///< vertical left
|
|
|
|
HT_DIR_VR = 5, ///< vertical right
|
|
|
|
HT_DIR_MASK = 0x7 ///< masks the drag-direction
|
2004-08-09 19:04:08 +02:00
|
|
|
};
|
2008-01-09 10:45:45 +01:00
|
|
|
DECLARE_ENUM_AS_BIT_SET(HighLightStyle);
|
|
|
|
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2007-03-07 13:11:48 +01:00
|
|
|
struct TileHighlightData {
|
2004-08-09 19:04:08 +02:00
|
|
|
Point size;
|
|
|
|
Point outersize;
|
|
|
|
Point pos;
|
|
|
|
Point offs;
|
|
|
|
|
|
|
|
Point new_pos;
|
|
|
|
Point new_size;
|
|
|
|
Point new_outersize;
|
|
|
|
|
|
|
|
Point selend, selstart;
|
|
|
|
|
|
|
|
byte dirty;
|
|
|
|
byte sizelimit;
|
|
|
|
|
2005-01-19 21:55:23 +01:00
|
|
|
byte drawstyle; // lower bits 0-3 are reserved for detailed highlight information information
|
|
|
|
byte new_drawstyle; // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new
|
|
|
|
byte next_drawstyle; // queued, but not yet drawn style
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2007-11-19 00:13:53 +01:00
|
|
|
ViewportHighlightMode place_mode;
|
2004-08-09 19:04:08 +02:00
|
|
|
bool make_square_red;
|
2005-01-03 22:29:59 +01:00
|
|
|
WindowClass window_class;
|
|
|
|
WindowNumber window_number;
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2007-11-15 19:21:59 +01:00
|
|
|
ViewportPlaceMethod select_method;
|
2007-05-23 14:45:56 +02:00
|
|
|
byte select_proc;
|
|
|
|
|
2004-08-09 19:04:08 +02:00
|
|
|
TileIndex redsq;
|
2007-03-07 13:11:48 +01:00
|
|
|
};
|
2004-08-09 19:04:08 +02:00
|
|
|
|
2008-01-09 10:45:45 +01:00
|
|
|
#endif /* VIEWPORT_TYPE_H */
|