Mercurial > hg > openttd
changeset 18684:55b1341827bd draft
(svn r23532) -Codechange: unify widget naming of (extra) viewport
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 16 Dec 2011 16:29:53 +0000 |
parents | 20868d80cd57 |
children | 0ed4ec9dfad8 |
files | src/viewport_gui.cpp src/widgets/viewport_widget.h |
diffstat | 2 files changed, 22 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -26,20 +26,20 @@ static const NWidgetPart _nested_extra_view_port_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, EVW_CAPTION), SetDataTip(STR_EXTRA_VIEW_PORT_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_EV_CAPTION), SetDataTip(STR_EXTRA_VIEW_PORT_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(NWID_VIEWPORT, INVALID_COLOUR, EVW_VIEWPORT), SetPadding(2, 2, 2, 2), SetResize(1, 1), SetFill(1, 1), + 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, EVW_ZOOMIN), SetDataTip(SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, EVW_ZOOMOUT), SetDataTip(SPR_IMG_ZOOMOUT, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_OUT), + 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, EVW_MAIN_TO_VIEW), SetFill(1, 1), SetResize(1, 0), + 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, EVW_VIEW_TO_MAIN), SetFill(1, 1), SetResize(1, 0), + 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(), @@ -55,9 +55,9 @@ { this->InitNested(desc, window_number); - NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(EVW_VIEWPORT); + NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_EV_VIEWPORT); nvp->InitializeViewport(this, 0, ZOOM_LVL_VIEWPORT); - if (_settings_client.gui.zoom_min == ZOOM_LVL_VIEWPORT) this->DisableWidget(EVW_ZOOMIN); + if (_settings_client.gui.zoom_min == ZOOM_LVL_VIEWPORT) this->DisableWidget(WID_EV_ZOOM_IN); Point pt; if (tile == INVALID_TILE) { @@ -80,7 +80,7 @@ virtual void SetStringParameters(int widget) const { switch (widget) { - case EVW_CAPTION: + case WID_EV_CAPTION: /* set the number in the title bar */ SetDParam(0, this->window_number + 1); break; @@ -90,10 +90,10 @@ 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 WID_EV_ZOOM_IN: DoZoomInOutWindow(ZOOM_IN, this); break; + case WID_EV_ZOOM_OUT: DoZoomInOutWindow(ZOOM_OUT, this); break; - case EVW_MAIN_TO_VIEW: { // location button (move main view to same spot as this view) 'Paste Location' + case WID_EV_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; @@ -105,7 +105,7 @@ break; } - case EVW_VIEW_TO_MAIN: { // inverse location button (move this view to same spot as main view) 'Copy Location' + case WID_EV_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; @@ -120,7 +120,7 @@ virtual void OnResize() { if (this->viewport != NULL) { - NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(EVW_VIEWPORT); + NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_EV_VIEWPORT); nvp->UpdateViewportCoordinates(this); } } @@ -149,7 +149,7 @@ { if (!gui_scope) return; /* Only handle zoom message if intended for us (msg ZOOM_IN/ZOOM_OUT) */ - HandleZoomMessage(this, this->viewport, EVW_ZOOMIN, EVW_ZOOMOUT); + HandleZoomMessage(this, this->viewport, WID_EV_ZOOM_IN, WID_EV_ZOOM_OUT); } };
--- a/src/widgets/viewport_widget.h +++ b/src/widgets/viewport_widget.h @@ -13,13 +13,13 @@ #define WIDGETS_VIEWPORT_WIDGET_H /** Widgets of the WC_EXTRA_VIEW_PORT. */ -enum ExtraViewportWindowWidgets { - EVW_CAPTION, - EVW_VIEWPORT, - EVW_ZOOMIN, - EVW_ZOOMOUT, - EVW_MAIN_TO_VIEW, - EVW_VIEW_TO_MAIN, +enum ExtraViewportWidgets { + WID_EV_CAPTION, ///< Caption of window. + WID_EV_VIEWPORT, ///< The viewport. + WID_EV_ZOOM_IN, ///< Zoom in. + WID_EV_ZOOM_OUT, ///< Zoom out. + WID_EV_MAIN_TO_VIEW, ///< Center the view of this viewport on the main view. + WID_EV_VIEW_TO_MAIN, ///< Center the main view on the view of this viewport. }; #endif /* WIDGETS_VIEWPORT_WIDGET_H */