# viewport_type.h

Go to the documentation of this file.

    00001 /* $Id: viewport_type.h 25264 2013-05-19 14:49:25Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef VIEWPORT_TYPE_H
    00013 #define VIEWPORT_TYPE_H
    00014
    00015 #include "zoom_type.h"
    00016 #include "strings_type.h"
    00017
    00018 class LinkGraphOverlay;
    00019
    00023 struct ViewPort {
    00024   int left;
    00025   int top;
    00026   int width;
    00027   int height;
    00028
    00029   int virtual_left;
    00030   int virtual_top;
    00031   int virtual_width;
    00032   int virtual_height;
    00033
    00034   ZoomLevel zoom;
    00035   LinkGraphOverlay *overlay;
    00036 };
    00037
    00039 enum ViewportSignMargin {
    00040   VPSM_LEFT   = 1,
    00041   VPSM_RIGHT  = 1,
    00042   VPSM_TOP    = 1,
    00043   VPSM_BOTTOM = 1,
    00044 };
    00045
    00047 struct ViewportSign {
    00048   int32 center;
    00049   int32 top;
    00050   uint16 width_normal;
    00051   uint16 width_small;
    00052
    00053   void UpdatePosition(int center, int top, StringID str);
    00054   void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
    00055 };
    00056
    00061 enum ZoomStateChange {
    00062   ZOOM_IN   = 0,
    00063   ZOOM_OUT  = 1,
    00064   ZOOM_NONE = 2,
    00065 };
    00066
    00073 static const uint BB_HEIGHT_UNDER_BRIDGE = 6;
    00074 static const uint BB_Z_SEPARATOR         = 7;
    00075
    00077 enum ViewportPlaceMethod {
    00078   VPM_X_OR_Y          =    0,
    00079   VPM_FIX_X           =    1,
    00080   VPM_FIX_Y           =    2,
    00081   VPM_X_AND_Y         =    3,
    00082   VPM_X_AND_Y_LIMITED =    4,
    00083   VPM_FIX_HORIZONTAL  =    5,
    00084   VPM_FIX_VERTICAL    =    6,
    00085   VPM_X_LIMITED       =    7,
    00086   VPM_Y_LIMITED       =    8,
    00087   VPM_RAILDIRS        = 0x40,
    00088   VPM_SIGNALDIRS      = 0x80,
    00089 };
    00090 DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod)
    00091
    00092
    00096 enum ViewportDragDropSelectionProcess {
    00097   DDSP_DEMOLISH_AREA,
    00098   DDSP_RAISE_AND_LEVEL_AREA,
    00099   DDSP_LOWER_AND_LEVEL_AREA,
    00100   DDSP_LEVEL_AREA,
    00101   DDSP_CREATE_DESERT,
    00102   DDSP_CREATE_ROCKS,
    00103   DDSP_CREATE_WATER,
    00104   DDSP_CREATE_RIVER,
    00105   DDSP_PLANT_TREES,
    00106   DDSP_BUILD_BRIDGE,
    00107
    00108   /* Rail specific actions */
    00109   DDSP_PLACE_RAIL,
    00110   DDSP_BUILD_SIGNALS,
    00111   DDSP_BUILD_STATION,
    00112   DDSP_REMOVE_STATION,
    00113   DDSP_CONVERT_RAIL,
    00114
    00115   /* Road specific actions */
    00116   DDSP_PLACE_ROAD_X_DIR,
    00117   DDSP_PLACE_ROAD_Y_DIR,
    00118   DDSP_PLACE_AUTOROAD,
    00119   DDSP_BUILD_BUSSTOP,
    00120   DDSP_BUILD_TRUCKSTOP,
    00121   DDSP_REMOVE_BUSSTOP,
    00122   DDSP_REMOVE_TRUCKSTOP,
    00123 };
    00124
    00125 #endif /* VIEWPORT_TYPE_H */