(svn r18087) -Codechange: remove NWID_LAYERED

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
rubidium 15 years ago
parent 3d2d7af88f
commit 9396a701fe

@ -67,32 +67,30 @@ static const NWidgetPart _nested_smallmap_widgets[] = {
/* 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. */

@ -1175,9 +1175,8 @@ static inline uint ComputeOffset(uint space, uint max_space)
/**
* 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 @@ void NWidgetStacked::Draw(const Window *w)
{
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 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
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 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
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 @@ static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase *pare
/* 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;

@ -119,7 +119,6 @@ enum WidgetType {
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 @@ static const int STACKED_SELECTION_ZERO_SIZE = INT_MAX; ///< Display plane value
*/
class NWidgetStacked : public NWidgetContainer {
public:
NWidgetStacked(WidgetType tp);
NWidgetStacked();
void SetIndex(int index);

Loading…
Cancel
Save