@@ -53,56 +53,56 @@ static const NWidgetPart _nested_extra_v
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 0), EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
};
class ExtraViewportWindow : public Window {
public:
ExtraViewportWindow(const WindowDesc *desc, int window_number, TileIndex tile) : Window()
{
this->InitNested(desc, window_number);
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(EVW_VIEWPORT);
nvp->InitializeViewport(this, 0, ZOOM_LVL_NORMAL);
this->DisableWidget(EVW_ZOOMIN);
Point pt;
if (tile == INVALID_TILE) {
/* the main window with the main view */
const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
/* center on same place as main window (zoom is maximum, no adjustment needed) */
pt.x = w->viewport->scrollpos_x + w->viewport->virtual_height / 2;
pt.x = w->viewport->scrollpos_x + w->viewport->virtual_width / 2;
pt.y = w->viewport->scrollpos_y + w->viewport->virtual_height / 2;
} else {
pt = RemapCoords(TileX(tile) * TILE_SIZE + TILE_SIZE / 2, TileY(tile) * TILE_SIZE + TILE_SIZE / 2, TileHeight(tile));
}
this->viewport->scrollpos_x = pt.x - (nvp->pos_x - ((nvp->current_x - 1) / 2));
this->viewport->scrollpos_y = pt.y - (nvp->pos_y - ((nvp->current_y - 1) / 2));
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)
case EVW_ZOOMIN: DoZoomInOutWindow(ZOOM_IN, this); break;
case EVW_ZOOMOUT: DoZoomInOutWindow(ZOOM_OUT, this); break;
Status change: