diff -r 9a27928bcd5e -r ebf0ece7d8f6 src/misc_gui.cpp --- a/src/misc_gui.cpp Thu Nov 22 23:01:41 2007 +0000 +++ b/src/misc_gui.cpp Fri Nov 23 16:59:30 2007 +0000 @@ -60,13 +60,13 @@ if (e->event == WE_PAINT) { DrawWindowWidgets(w); - DoDrawStringCentered(140, 16, _landinfo_data[0], 13); - DoDrawStringCentered(140, 27, _landinfo_data[1], 0); - DoDrawStringCentered(140, 38, _landinfo_data[2], 0); - DoDrawStringCentered(140, 49, _landinfo_data[3], 0); - DoDrawStringCentered(140, 60, _landinfo_data[4], 0); + DoDrawStringCentered(140, 16, _landinfo_data[0], TC_LIGHT_BLUE); + DoDrawStringCentered(140, 27, _landinfo_data[1], TC_FROMSTRING); + DoDrawStringCentered(140, 38, _landinfo_data[2], TC_FROMSTRING); + DoDrawStringCentered(140, 49, _landinfo_data[3], TC_FROMSTRING); + DoDrawStringCentered(140, 60, _landinfo_data[4], TC_FROMSTRING); if (_landinfo_data[5][0] != '\0') DrawStringMultiCenter(140, 76, BindCString(_landinfo_data[5]), w->width - 4); - if (_landinfo_data[6][0] != '\0') DoDrawStringCentered(140, 71, _landinfo_data[6], 0); + if (_landinfo_data[6][0] != '\0') DoDrawStringCentered(140, 71, _landinfo_data[6], TC_FROMSTRING); } } @@ -199,7 +199,7 @@ ResetObjectToPlace(); } else { _place_proc = Place_LandInfo; - SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, 1, WC_MAIN_TOOLBAR, 0); + SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, VHM_RECT, WC_MAIN_TOOLBAR, 0); } } @@ -223,12 +223,12 @@ " Peter Nelson (peter1138) - Spiritual descendant from newgrf gods", " Remko Bijker (Rubidium) - THE desync hunter", " Christoph Mallon (Tron) - Programmer, code correctness police", - " Patric Stout (TrueLight) - Coder, network guru, SVN-, MS- and website host", "", "Retired Developers:", " Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)", " Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)", " Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)", + " Patric Stout (TrueLight) - Programmer, webhoster (0.3 - pre0.6)", "", "Special thanks go out to:", " Josef Drexler - For his great work on TTDPatch", @@ -265,13 +265,13 @@ DrawWindowWidgets(w); /* Show original copyright and revision version */ - DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, 0); - DrawStringCentered(210, 17 + 10, STR_00B7_VERSION, 0); + DrawStringCentered(210, 17, STR_00B6_ORIGINAL_COPYRIGHT, TC_FROMSTRING); + DrawStringCentered(210, 17 + 10, STR_00B7_VERSION, TC_FROMSTRING); /* Show all scrolling credits */ for (i = 0; i < lengthof(credits); i++) { if (y >= 50 && y < (w->height - 40)) { - DoDrawString(credits[i], 10, y, 0x10); + DoDrawString(credits[i], 10, y, TC_BLACK); } y += 10; } @@ -279,8 +279,8 @@ /* If the last text has scrolled start anew from the start */ if (y < 50) WP(w, scroller_d).height = w->height - 40; - DoDrawStringCentered(210, w->height - 25, "Website: http://www.openttd.org", 16); - DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, 0); + DoDrawStringCentered(210, w->height - 25, "Website: http://www.openttd.org", TC_BLACK); + DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, TC_FROMSTRING); } break; case WE_MOUSELOOP: // Timer to scroll the text and adjust the new top if (WP(w, scroller_d).counter++ % 3 == 0) { @@ -366,12 +366,12 @@ case 11:case 12: case 13: case 14: if (wid - 3 >= WP(w,tree_d).count) break; - if (HandlePlacePushButton(w, wid, SPR_CURSOR_TREE, 1, NULL)) + if (HandlePlacePushButton(w, wid, SPR_CURSOR_TREE, VHM_RECT, NULL)) _tree_to_plant = WP(w,tree_d).base + wid - 3; break; case 15: // tree of random type. - if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, 1, NULL)) + if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, VHM_RECT, NULL)) _tree_to_plant = -1; break; @@ -609,8 +609,8 @@ if ( (x|y) != 0) { pt = RemapCoords2(x, y); vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; - pt.x = clamp(UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left - (334/2), 0, _screen.width - 334); - pt.y = clamp(UnScaleByZoom(pt.y - vp->virtual_top, vp->zoom) + vp->top - (137/2), 22, _screen.height - 137); + pt.x = Clamp(UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left - (334/2), 0, _screen.width - 334); + pt.y = Clamp(UnScaleByZoom(pt.y - vp->virtual_top, vp->zoom) + vp->top - (137/2), 22, _screen.height - 137); } else { pt.x = (_screen.width - 334) >> 1; pt.y = (_screen.height - 137) >> 1; @@ -746,9 +746,9 @@ /* Correctly position the tooltip position, watch out for window and cursor size * Clamp value to below main toolbar and above statusbar. If tooltip would * go below window, flip it so it is shown above the cursor */ - y = clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, 22, _screen.height - 12); + y = Clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, 22, _screen.height - 12); if (y + br.height > _screen.height - 12) y = _cursor.pos.y + _cursor.offs.y - br.height - 5; - x = clamp(_cursor.pos.x - (br.width >> 1), 0, _screen.width - br.width); + x = Clamp(_cursor.pos.x - (br.width >> 1), 0, _screen.width - br.width); w = AllocateWindow(x, y, br.width, br.height, TooltipsWndProc, WC_TOOLTIPS, _tooltips_widgets); @@ -1087,8 +1087,8 @@ if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; - DoDrawString(tb->buf, delta, 0, 8); - if (tb->caret) DoDrawString("_", tb->caretxoffs + delta, 0, 12); + DoDrawString(tb->buf, delta, 0, TC_YELLOW); + if (tb->caret) DoDrawString("_", tb->caretxoffs + delta, 0, TC_WHITE); _cur_dpi = old_dpi; } @@ -1106,7 +1106,7 @@ switch (e->event) { case WE_CREATE: - SETBIT(_no_scroll, SCROLL_EDIT); + SetBit(_no_scroll, SCROLL_EDIT); break; case WE_PAINT: @@ -1162,7 +1162,7 @@ e.event = WE_ON_EDIT_TEXT_CANCEL; parent->wndproc(parent, &e); } - CLRBIT(_no_scroll, SCROLL_EDIT); + ClrBit(_no_scroll, SCROLL_EDIT); break; } } @@ -1370,7 +1370,10 @@ }; /* Colors for fios types */ -const byte _fios_colors[] = {13, 9, 9, 6, 5, 6, 5, 6, 6, 8}; +const TextColour _fios_colors[] = { + TC_LIGHT_BLUE, TC_DARK_GREEN, TC_DARK_GREEN, TC_ORANGE, TC_LIGHT_BROWN, + TC_ORANGE, TC_LIGHT_BROWN, TC_ORANGE, TC_ORANGE, TC_YELLOW +}; void BuildFileList() { @@ -1401,8 +1404,8 @@ } if (str != STR_4006_UNABLE_TO_READ_DRIVE) SetDParam(0, tot); - DrawString(2, 37, str, 0); - DoDrawStringTruncated(path, 2, 27, 16, maxw); + DrawString(2, 37, str, TC_FROMSTRING); + DoDrawStringTruncated(path, 2, 27, TC_BLACK, maxw); } static void MakeSortedSaveGameList() @@ -1491,7 +1494,7 @@ DoDrawString( _savegame_sort_order & SORT_DESCENDING ? DOWNARROW : UPARROW, _savegame_sort_order & SORT_BY_NAME ? w->widget[2].right - 9 : w->widget[3].right - 9, - 15, 16 + 15, TC_BLACK ); y = w->widget[7].top + 1; @@ -1621,7 +1624,7 @@ DoCommandP(0, 0, 0, NULL, CMD_PAUSE); } FiosFreeSavegameList(); - CLRBIT(_no_scroll, SCROLL_SAVE); + ClrBit(_no_scroll, SCROLL_SAVE); break; case WE_RESIZE: { /* Widget 2 and 3 have to go with halve speed, make it so obiwan */ @@ -1672,12 +1675,12 @@ const WindowDesc *sld = &_save_dialog_desc; - SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, 0, WC_MAIN_WINDOW, 0); + SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0); DeleteWindowById(WC_QUERY_STRING, 0); DeleteWindowById(WC_SAVELOAD, 0); _saveload_mode = mode; - SETBIT(_no_scroll, SCROLL_SAVE); + SetBit(_no_scroll, SCROLL_SAVE); switch (mode) { case SLD_SAVE_GAME: GenerateFileName(); break; @@ -1900,7 +1903,7 @@ } break; } - DrawString(50, y + 1, ce->str, 0); + DrawString(50, y + 1, ce->str, TC_FROMSTRING); y += 12; } @@ -1935,7 +1938,7 @@ /* Increase or decrease the value and clamp it to extremes */ value += (x >= 30) ? step : -step; - value = clamp(value, ce->min, ce->max); + value = Clamp(value, ce->min, ce->max); /* take whatever the function returns */ value = ce->proc(value, (x >= 30) ? 1 : -1);