viewport_type.h

Go to the documentation of this file.
00001 /* $Id$ */
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 #include "math.h"
00018 
00022 struct ViewPort {
00023   int left;    
00024   int top;     
00025   int width;   
00026   int height;  
00027 
00028   int virtual_left;    
00029   int virtual_top;     
00030   int virtual_width;   
00031   int virtual_height;  
00032 
00033   ZoomLevel zoom; 
00034 };
00035 
00037 enum ViewportSignMargin {
00038   VPSM_LEFT   = 1, 
00039   VPSM_RIGHT  = 1, 
00040   VPSM_TOP    = 1, 
00041   VPSM_BOTTOM = 1, 
00042 };
00043 
00045 struct ViewportSign {
00046   int32 center;        
00047   int32 top;           
00048   uint16 width_normal; 
00049   uint16 width_small;  
00050 
00051   void UpdatePosition(int center, int top, StringID str);
00052   void MarkDirty() const;
00053 };
00054 
00059 enum ZoomStateChange {
00060   ZOOM_IN   = 0, 
00061   ZOOM_OUT  = 1, 
00062   ZOOM_NONE = 2, 
00063 };
00064 
00071 static const uint BB_HEIGHT_UNDER_BRIDGE = 6; 
00072 static const uint BB_Z_SEPARATOR         = 7; 
00073 
00075 enum ViewportPlaceMethod {
00076   VPM_X_OR_Y          =    0, 
00077   VPM_FIX_X           =    1, 
00078   VPM_FIX_Y           =    2, 
00079   VPM_X_AND_Y         =    3, 
00080   VPM_X_AND_Y_LIMITED =    4, 
00081   VPM_FIX_HORIZONTAL  =    5, 
00082   VPM_FIX_VERTICAL    =    6, 
00083   VPM_X_LIMITED       =    7, 
00084   VPM_Y_LIMITED       =    8, 
00085   VPM_A_B_LINE        =    9, 
00086   VPM_RAILDIRS        = 0x40, 
00087   VPM_SIGNALDIRS      = 0x80, 
00088 };
00089 DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod)
00090 
00091 
00095 enum ViewportDragDropSelectionProcess {
00096   DDSP_DEMOLISH_AREA,        
00097   DDSP_RAISE_AND_LEVEL_AREA, 
00098   DDSP_LOWER_AND_LEVEL_AREA, 
00099   DDSP_LEVEL_AREA,           
00100   DDSP_CREATE_DESERT,        
00101   DDSP_CREATE_ROCKS,         
00102   DDSP_CREATE_WATER,         
00103   DDSP_CREATE_RIVER,         
00104   DDSP_PLANT_TREES,          
00105   DDSP_BUILD_BRIDGE,         
00106   DDSP_COPY_AREA,            
00107   DDSP_MEASURE,              
00108 
00109   /* Rail specific actions */
00110   DDSP_PLACE_RAIL,           
00111   DDSP_BUILD_SIGNALS,        
00112   DDSP_BUILD_STATION,        
00113   DDSP_REMOVE_STATION,       
00114   DDSP_CONVERT_RAIL,         
00115 
00116   /* Road specific actions */
00117   DDSP_PLACE_ROAD_X_DIR,     
00118   DDSP_PLACE_ROAD_Y_DIR,     
00119   DDSP_PLACE_AUTOROAD,       
00120   DDSP_BUILD_BUSSTOP,        
00121   DDSP_BUILD_TRUCKSTOP,      
00122   DDSP_REMOVE_BUSSTOP,       
00123   DDSP_REMOVE_TRUCKSTOP,     
00124 };
00125 
00126 #endif /* VIEWPORT_TYPE_H */