Mercurial > hg > openttd
changeset 18690:e6e5c2744d8c draft
(svn r23538) -Codechange: Consistent naming of widgets in tree plant gui
author | planetmaker <planetmaker@openttd.org> |
---|---|
date | Fri, 16 Dec 2011 16:57:15 +0000 |
parents | 53117493f44b |
children | c03efc6b82b4 |
files | src/tree_gui.cpp src/widgets/tree_widget.h |
diffstat | 2 files changed, 43 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -84,7 +84,7 @@ virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget >= BTW_TYPE_11 && widget <= BTW_TYPE_34) { + if (widget >= WID_BT_TYPE_11 && widget <= WID_BT_TYPE_34) { Dimension d = GetMaxTreeSpriteSize(); /* Allow some pixels extra width and height */ size->width = d.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; @@ -92,7 +92,7 @@ return; } - if (widget != BTW_MANY_RANDOM) return; + if (widget != WID_BT_MANY_RANDOM) return; if (_game_mode != GM_EDITOR) { size->width = 0; @@ -107,9 +107,9 @@ virtual void DrawWidget(const Rect &r, int widget) const { - if (widget < BTW_TYPE_11 || widget > BTW_TYPE_34 || widget - BTW_TYPE_11 >= this->count) return; + if (widget < WID_BT_TYPE_11 || widget > WID_BT_TYPE_34 || widget - WID_BT_TYPE_11 >= this->count) return; - int i = this->base + widget - BTW_TYPE_11; + int i = this->base + widget - WID_BT_TYPE_11; /* Trees "grow" in the centre on the bottom line of the buttons */ DrawSprite(tree_sprites[i].sprite, tree_sprites[i].pal, (r.left + r.right) / 2 + WD_FRAMERECT_LEFT, r.bottom - 7); } @@ -117,24 +117,24 @@ virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case BTW_TYPE_11: case BTW_TYPE_12: case BTW_TYPE_13: case BTW_TYPE_14: - case BTW_TYPE_21: case BTW_TYPE_22: case BTW_TYPE_23: case BTW_TYPE_24: - case BTW_TYPE_31: case BTW_TYPE_32: case BTW_TYPE_33: case BTW_TYPE_34: - if (widget - BTW_TYPE_11 >= this->count) break; + case WID_BT_TYPE_11: case WID_BT_TYPE_12: case WID_BT_TYPE_13: case WID_BT_TYPE_14: + case WID_BT_TYPE_21: case WID_BT_TYPE_22: case WID_BT_TYPE_23: case WID_BT_TYPE_24: + case WID_BT_TYPE_31: case WID_BT_TYPE_32: case WID_BT_TYPE_33: case WID_BT_TYPE_34: + if (widget - WID_BT_TYPE_11 >= this->count) break; if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT)) { - this->tree_to_plant = (TreeType)(this->base + widget - BTW_TYPE_11); + this->tree_to_plant = (TreeType)(this->base + widget - WID_BT_TYPE_11); } break; - case BTW_TYPE_RANDOM: // tree of random type. - if (HandlePlacePushButton(this, BTW_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT)) { + case WID_BT_TYPE_RANDOM: // tree of random type. + if (HandlePlacePushButton(this, WID_BT_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT)) { this->tree_to_plant = TREE_INVALID; } break; - case BTW_MANY_RANDOM: // place trees randomly over the landscape - this->LowerWidget(BTW_MANY_RANDOM); + case WID_BT_MANY_RANDOM: // place trees randomly over the landscape + this->LowerWidget(WID_BT_MANY_RANDOM); this->SetTimeout(); SndPlayFx(SND_15_BEEP); PlaceTreesRandomly(); @@ -173,8 +173,8 @@ virtual void OnTimeout() { - this->RaiseWidget(BTW_MANY_RANDOM); - this->SetWidgetDirty(BTW_MANY_RANDOM); + this->RaiseWidget(WID_BT_MANY_RANDOM); + this->SetWidgetDirty(WID_BT_MANY_RANDOM); } virtual void OnPlaceObjectAbort() @@ -196,50 +196,50 @@ NWidget(NWID_SPACER), SetMinimalSize(2, 0), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_11), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_11), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_12), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_12), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_13), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_13), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_14), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_14), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 1), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_21), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_21), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_22), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_22), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_23), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_23), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_24), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_24), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 1), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_31), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_31), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_32), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_32), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_33), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_33), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, BTW_TYPE_34), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_34), SetMinimalSize(34, 46), SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREY, BTW_TYPE_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TYPE, STR_TREES_RANDOM_TYPE_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BT_TYPE_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TYPE, STR_TREES_RANDOM_TYPE_TOOLTIP), NWidget(NWID_SPACER), SetMinimalSize(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREY, BTW_MANY_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BT_MANY_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP), NWidget(NWID_SPACER), SetMinimalSize(0, 2), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(2, 0),
--- a/src/widgets/tree_widget.h +++ b/src/widgets/tree_widget.h @@ -14,20 +14,20 @@ /** Widgets of the WC_BUILD_TREES. */ enum BuildTreesWidgets { - BTW_TYPE_11, - BTW_TYPE_12, - BTW_TYPE_13, - BTW_TYPE_14, - BTW_TYPE_21, - BTW_TYPE_22, - BTW_TYPE_23, - BTW_TYPE_24, - BTW_TYPE_31, - BTW_TYPE_32, - BTW_TYPE_33, - BTW_TYPE_34, - BTW_TYPE_RANDOM, - BTW_MANY_RANDOM, + WID_BT_TYPE_11, + WID_BT_TYPE_12, + WID_BT_TYPE_13, + WID_BT_TYPE_14, + WID_BT_TYPE_21, + WID_BT_TYPE_22, + WID_BT_TYPE_23, + WID_BT_TYPE_24, + WID_BT_TYPE_31, + WID_BT_TYPE_32, + WID_BT_TYPE_33, + WID_BT_TYPE_34, + WID_BT_TYPE_RANDOM, + WID_BT_MANY_RANDOM, }; #endif /* WIDGETS_TREE_WIDGET_H */