File diff r14398:461a80e5f996 → r14399:3f819c0da60a
src/viewport_gui.cpp
Show inline comments
 
@@ -80,49 +80,49 @@ public:
 
			pt = RemapCoords(TileX(tile) * TILE_SIZE + TILE_SIZE / 2, TileY(tile) * TILE_SIZE + TILE_SIZE / 2, TileHeight(tile));
 
		}
 

	
 
		this->viewport->scrollpos_x = pt.x - this->viewport->virtual_width / 2;
 
		this->viewport->scrollpos_y = pt.y - this->viewport->virtual_height / 2;
 
		this->viewport->dest_scrollpos_x = this->viewport->scrollpos_x;
 
		this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y;
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case EVW_CAPTION:
 
				/* set the number in the title bar */
 
				SetDParam(0, this->window_number + 1);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case EVW_ZOOMIN: DoZoomInOutWindow(ZOOM_IN,  this); break;
 
			case EVW_ZOOMOUT: DoZoomInOutWindow(ZOOM_OUT, this); break;
 

	
 
			case EVW_MAIN_TO_VIEW: { // location button (move main view to same spot as this view) 'Paste Location'
 
				Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 
				int x = this->viewport->scrollpos_x; // Where is the main looking at
 
				int y = this->viewport->scrollpos_y;
 

	
 
				/* set this view to same location. Based on the center, adjusting for zoom */
 
				w->viewport->dest_scrollpos_x =  x - (w->viewport->virtual_width -  this->viewport->virtual_width) / 2;
 
				w->viewport->dest_scrollpos_y =  y - (w->viewport->virtual_height - this->viewport->virtual_height) / 2;
 
				w->viewport->follow_vehicle   = INVALID_VEHICLE;
 
			} break;
 

	
 
			case EVW_VIEW_TO_MAIN: { // inverse location button (move this view to same spot as main view) 'Copy Location'
 
				const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 
				int x = w->viewport->scrollpos_x;
 
				int y = w->viewport->scrollpos_y;
 

	
 
				this->viewport->dest_scrollpos_x =  x + (w->viewport->virtual_width -  this->viewport->virtual_width) / 2;
 
				this->viewport->dest_scrollpos_y =  y + (w->viewport->virtual_height - this->viewport->virtual_height) / 2;
 
			} break;