OpenTTD Source: src/viewport_gui.cpp File Reference

OpenTTD Source 15.0-beta1

Data Structures | Functions | Variables
viewport_gui.cpp File Reference

Extra viewport window. More...

`#include "stdafx.h"`
`#include "landscape.h"`
`#include "window_gui.h"`
`#include "viewport_func.h"`
`#include "strings_func.h"`
`#include "zoom_func.h"`
`#include "window_func.h"`
`#include "widgets/viewport_widget.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
class | ExtraViewportWindow

## Functions
void | ShowExtraViewportWindow (TileIndex tile)
| Show a new Extra Viewport window.
void | ShowExtraViewportWindowForTileUnderCursor ()
| Show a new Extra Viewport window.

## Variables
static constexpr NWidgetPart | _nested_extra_viewport_widgets []
static WindowDesc | _extra_viewport_desc (WDP_AUTO, "extra_viewport", 300, 268, WC_EXTRA_VIEWPORT, WC_NONE, 0, _nested_extra_viewport_widgets)

## Detailed Description

Extra viewport window.

Definition in file viewport_gui.cpp.

## Function Documentation

## ◆ ShowExtraViewportWindow()

void ShowExtraViewportWindow | ( | TileIndex | tile | ) |

Show a new Extra Viewport window.

Parameters

  tile | Tile to center the view on. INVALID_TILE means to use the center of main viewport.

Definition at line 156 of file viewport_gui.cpp.

References FindWindowById(), and WC_EXTRA_VIEWPORT.

Referenced by GoalListWindow::HandleClick(), MenuClickMap(), CompanyWindow::OnClick(), DepotWindow::OnClick(), IndustryViewWindow::OnClick(), IndustryDirectoryWindow::OnClick(), LandInfoWindow::OnClick(), NewsWindow::OnClick(), SignWindow::OnClick(), CompanyStationsWindow::OnClick(), StationViewWindow::OnClick(), TownViewWindow::OnClick(), TownDirectoryWindow::OnClick(), VehicleViewWindow::OnClick(), WaypointWindow::OnClick(), StoryBookWindow::OnPageElementClick(), and ShowExtraViewportWindowForTileUnderCursor().

## ◆ ShowExtraViewportWindowForTileUnderCursor()

void ShowExtraViewportWindowForTileUnderCursor | ( |  | ) |

Show a new Extra Viewport window.

Center it on the tile under the cursor, if the cursor is inside a viewport. If that fails, center it on main viewport center.

Definition at line 171 of file viewport_gui.cpp.

References INVALID_TILE, ShowExtraViewportWindow(), and TileVirtXY().

Referenced by MainToolbarWindow::OnHotkey(), and ScenarioEditorToolbarWindow::OnHotkey().

## Variable Documentation

## ◆ _nested_extra_viewport_widgets

constexpr NWidgetPart _nested_extra_viewport_widgets[]
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_EV_CAPTION), SetDataTip(STR_EXTRA_VIEWPORT_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_EV_VIEWPORT), SetPadding(2, 2, 2, 2), SetResize(1, 1), SetFill(1, 1),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_EV_ZOOM_IN), SetDataTip(SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_EV_ZOOM_OUT), SetDataTip(SPR_IMG_ZOOMOUT, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_OUT),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_EV_MAIN_TO_VIEW), SetFill(1, 1), SetResize(1, 0),
SetDataTip(STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW, STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_EV_VIEW_TO_MAIN), SetFill(1, 1), SetResize(1, 0),
SetDataTip(STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN, STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 0), EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
}
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1181
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition widget_type.h:1228
SetDataTip
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
Definition widget_type.h:1202
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1320
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1191
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1126
WID_EV_MAIN_TO_VIEW
@ WID_EV_MAIN_TO_VIEW
Center the view of this viewport on the main view.
Definition viewport_widget.h:19
WID_EV_VIEW_TO_MAIN
@ WID_EV_VIEW_TO_MAIN
Center the main view on the view of this viewport.
Definition viewport_widget.h:20
WID_EV_CAPTION
@ WID_EV_CAPTION
Caption of window.
Definition viewport_widget.h:15
WID_EV_ZOOM_OUT
@ WID_EV_ZOOM_OUT
Zoom out.
Definition viewport_widget.h:18
WID_EV_VIEWPORT
@ WID_EV_VIEWPORT
The viewport.
Definition viewport_widget.h:16
WID_EV_ZOOM_IN
@ WID_EV_ZOOM_IN
Zoom in.
Definition viewport_widget.h:17
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition widget_type.h:524
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:113
WWT_PUSHIMGBTN
@ WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition widget_type.h:114
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:75
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:50
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:66
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition widget_type.h:64
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:61
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:69
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition widget_type.h:68
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition widget_type.h:65
NWID_VIEWPORT
@ NWID_VIEWPORT
Nested widget containing a viewport.
Definition widget_type.h:82

Definition at line 26 of file viewport_gui.cpp.