Mercurial > hg > openttd
changeset 13565:40a13e194fd0 draft
(svn r18087) -Codechange: remove NWID_LAYERED
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 15 Nov 2009 10:30:32 +0000 |
parents | bae287664b02 |
children | 30dc7b733ef3 |
files | src/smallmap_gui.cpp src/widget.cpp src/widget_type.h |
diffstat | 3 files changed, 33 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -67,32 +67,30 @@ /* Panel. */ NWidget(NWID_HORIZONTAL), NWidget(WWT_PANEL, COLOUR_BROWN, SM_WIDGET_LEGEND), SetMinimalSize(262, 44), SetResize(1, 0), EndContainer(), - NWidget(NWID_LAYERED), - NWidget(NWID_VERTICAL), - /* Top button row. */ - NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, SM_WIDGET_CENTERMAP), SetMinimalSize(22, 22), - SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER), - NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_CONTOUR), SetMinimalSize(22, 22), - SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP), - NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEHICLES), SetMinimalSize(22, 22), - SetDataTip(SPR_IMG_SHOW_VEHICLES, STR_SMALLMAP_TOOLTIP_SHOW_VEHICLES_ON_MAP), - NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_INDUSTRIES), SetMinimalSize(22, 22), - SetDataTip(SPR_IMG_INDUSTRY, STR_SMALLMAP_TOOLTIP_SHOW_INDUSTRIES_ON_MAP), - EndContainer(), - /* Bottom button row. */ - NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_TOGGLETOWNNAME), SetMinimalSize(22, 22), - SetDataTip(SPR_IMG_TOWN, STR_SMALLMAP_TOOLTIP_TOGGLE_TOWN_NAMES_ON_OFF), - NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_ROUTES), SetMinimalSize(22, 22), - SetDataTip(SPR_IMG_SHOW_ROUTES, STR_SMALLMAP_TOOLTIP_SHOW_TRANSPORT_ROUTES_ON), - NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEGETATION), SetMinimalSize(22, 22), - SetDataTip(SPR_IMG_PLANTTREES, STR_SMALLMAP_TOOLTIP_SHOW_VEGETATION_ON_MAP), - NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_OWNERS), SetMinimalSize(22, 22), - SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_SMALLMAP_TOOLTIP_SHOW_LAND_OWNERS_ON_MAP), - EndContainer(), - NWidget(WWT_PANEL, COLOUR_BROWN, SM_WIDGET_BUTTONSPANEL), SetFill(true, true), EndContainer(), + NWidget(NWID_VERTICAL), + /* Top button row. */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, SM_WIDGET_CENTERMAP), SetMinimalSize(22, 22), + SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER), + NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_CONTOUR), SetMinimalSize(22, 22), + SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP), + NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEHICLES), SetMinimalSize(22, 22), + SetDataTip(SPR_IMG_SHOW_VEHICLES, STR_SMALLMAP_TOOLTIP_SHOW_VEHICLES_ON_MAP), + NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_INDUSTRIES), SetMinimalSize(22, 22), + SetDataTip(SPR_IMG_INDUSTRY, STR_SMALLMAP_TOOLTIP_SHOW_INDUSTRIES_ON_MAP), EndContainer(), + /* Bottom button row. */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_TOGGLETOWNNAME), SetMinimalSize(22, 22), + SetDataTip(SPR_IMG_TOWN, STR_SMALLMAP_TOOLTIP_TOGGLE_TOWN_NAMES_ON_OFF), + NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_ROUTES), SetMinimalSize(22, 22), + SetDataTip(SPR_IMG_SHOW_ROUTES, STR_SMALLMAP_TOOLTIP_SHOW_TRANSPORT_ROUTES_ON), + NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEGETATION), SetMinimalSize(22, 22), + SetDataTip(SPR_IMG_PLANTTREES, STR_SMALLMAP_TOOLTIP_SHOW_VEGETATION_ON_MAP), + NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_OWNERS), SetMinimalSize(22, 22), + SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_SMALLMAP_TOOLTIP_SHOW_LAND_OWNERS_ON_MAP), + EndContainer(), + NWidget(WWT_PANEL, COLOUR_BROWN, SM_WIDGET_BUTTONSPANEL), SetFill(true, true), EndContainer(), EndContainer(), EndContainer(), /* Bottom button row and resize box. */
--- a/src/widget.cpp +++ b/src/widget.cpp @@ -1175,9 +1175,8 @@ /** * Widgets stacked on top of each other. - * @param tp Kind of stacking, must be either #NWID_SELECTION or #NWID_LAYERED. */ -NWidgetStacked::NWidgetStacked(WidgetType tp) : NWidgetContainer(tp) +NWidgetStacked::NWidgetStacked() : NWidgetContainer(NWID_SELECTION) { this->index = -1; } @@ -1268,21 +1267,15 @@ { if (this->shown_plane == STACKED_SELECTION_ZERO_SIZE) return; - if (this->type == NWID_SELECTION) { - int plane = 0; - for (NWidgetBase *child_wid = this->head; child_wid != NULL; plane++, child_wid = child_wid->next) { - if (plane == this->shown_plane) { - child_wid->Draw(w); - return; - } + int plane = 0; + for (NWidgetBase *child_wid = this->head; child_wid != NULL; plane++, child_wid = child_wid->next) { + if (plane == this->shown_plane) { + child_wid->Draw(w); + return; } } - assert(this->type == NWID_LAYERED); - /* Render from back to front. */ - for (NWidgetBase *child_wid = this->tail; child_wid != NULL; child_wid = child_wid->prev) { - child_wid->Draw(w); - } + NOT_REACHED(); } NWidgetCore *NWidgetStacked::GetWidgetFromPos(int x, int y) @@ -2448,12 +2441,6 @@ break; } - case NWID_LAYERED: - if (*dest != NULL) return num_used; - *dest = new NWidgetStacked(parts->type); - *fill_dest = true; - break; - case WPT_RESIZE: { NWidgetResizeBase *nwrb = dynamic_cast<NWidgetResizeBase *>(*dest); if (nwrb != NULL) { @@ -2511,7 +2498,7 @@ case NWID_SELECTION: { if (*dest != NULL) return num_used; - NWidgetStacked *nws = new NWidgetStacked(parts->type); + NWidgetStacked *nws = new NWidgetStacked(); *dest = nws; *fill_dest = true; nws->SetIndex(parts->u.widget.index); @@ -2567,7 +2554,7 @@ /* If sub-widget is a container, recursively fill that container. */ WidgetType tp = sub_widget->type; if (fill_sub && (tp == NWID_HORIZONTAL || tp == NWID_HORIZONTAL_LTR || tp == NWID_VERTICAL - || tp == WWT_PANEL || tp == WWT_FRAME || tp == WWT_INSET || tp == NWID_SELECTION || tp == NWID_LAYERED)) { + || tp == WWT_PANEL || tp == WWT_FRAME || tp == WWT_INSET || tp == NWID_SELECTION)) { int num_used = MakeWidgetTree(parts, count - total_used, sub_widget, biggest_index); parts += num_used; total_used += num_used;
--- a/src/widget_type.h +++ b/src/widget_type.h @@ -119,7 +119,6 @@ NWID_VERTICAL, ///< Vertical container. NWID_SPACER, ///< Invisible widget that takes some space. NWID_SELECTION, ///< Stacked widgets, only one visible at a time (eg in a panel with tabs). - NWID_LAYERED, ///< Widgets layered on top of each other, all visible at the same time. NWID_VIEWPORT, ///< Nested widget containing a viewport. NWID_BUTTON_DRPDOWN, ///< Button with a drop-down. @@ -388,7 +387,7 @@ */ class NWidgetStacked : public NWidgetContainer { public: - NWidgetStacked(WidgetType tp); + NWidgetStacked(); void SetIndex(int index);