From 0fe36a6900b135361a3f01b36a00d8ad6acac8bc Mon Sep 17 00:00:00 2001 From: tron Date: Sat, 10 Sep 2005 07:38:03 +0000 Subject: (svn r2932) Give the strings consisting of an up/a down arrow symbolic names --- aircraft_gui.c | 2 +- gfx.h | 7 +++++++ industry_gui.c | 2 +- misc_gui.c | 4 ++-- roadveh_gui.c | 2 +- ship_gui.c | 2 +- town_gui.c | 2 +- train_gui.c | 2 +- widget.c | 8 ++++---- 9 files changed, 19 insertions(+), 12 deletions(-) diff --git a/aircraft_gui.c b/aircraft_gui.c index 71a30e91a..eec495518 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -1051,7 +1051,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e) /* draw sorting criteria string */ DrawString(85, 15, _vehicle_sort_listing[vl->sort_type], 0x10); /* draw arrow pointing up/down for ascending/descending sorting */ - DoDrawString(vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10); + DoDrawString(vl->flags & VL_DESC ? DOWNARROW : UPARROW, 69, 15, 0x10); max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length); for (i = w->vscroll.pos; i < max; ++i) { diff --git a/gfx.h b/gfx.h index 44111da1e..d0568a78d 100644 --- a/gfx.h +++ b/gfx.h @@ -38,6 +38,13 @@ typedef struct CursorVars { void RedrawScreenRect(int left, int top, int right, int bottom); void GfxScroll(int left, int top, int width, int height, int xo, int yo); + +// XXX doesn't really belong here, but the only +// consumers always use it in conjunction with DoDrawString() +#define UPARROW "\xA0" +#define DOWNARROW "\xAA" + + int DrawStringCentered(int x, int y, StringID str, uint16 color); int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color); int DoDrawStringCentered(int x, int y, const char *str, uint16 color); diff --git a/industry_gui.c b/industry_gui.c index 5ee0ff9e1..18f4fd7fe 100644 --- a/industry_gui.c +++ b/industry_gui.c @@ -581,7 +581,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) SetVScrollCount(w, _num_industry_sort); DrawWindowWidgets(w); - DoDrawString(_industry_sort_order & 1 ? "\xAA" : "\xA0", _indicator_positions[_industry_sort_order>>1], 15, 0x10); + DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order>>1], 15, 0x10); p = w->vscroll.pos; n = 0; diff --git a/misc_gui.c b/misc_gui.c index 71dc6ff1f..356e9cb7c 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -1246,7 +1246,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) } GfxFillRect(w->widget[6].left + 1, w->widget[6].top + 1, w->widget[6].right, w->widget[6].bottom, 0xD7); - DoDrawString(_savegame_sort_order & 1 ? "\xAA" : "\xA0", _savegame_sort_order <= 1 ? w->widget[3].right - 9 : w->widget[2].right - 9, 15, 0x10); + DoDrawString(_savegame_sort_order & 1 ? DOWNARROW : UPARROW, _savegame_sort_order <= 1 ? w->widget[3].right - 9 : w->widget[2].right - 9, 15, 0x10); y = w->widget[6].top + 1; pos = w->vscroll.pos; @@ -1489,7 +1489,7 @@ static void SelectScenarioWndProc(Window *w, WindowEvent *e) { SetVScrollCount(w, _fios_num); DrawWindowWidgets(w); - DoDrawString(_savegame_sort_order & 1 ? "\xAA" : "\xA0", _savegame_sort_order <= 1 ? w->widget[4].right - 9 : w->widget[3].right - 9, 15, 0x10); + DoDrawString(_savegame_sort_order & 1 ? DOWNARROW : UPARROW, _savegame_sort_order <= 1 ? w->widget[4].right - 9 : w->widget[3].right - 9, 15, 0x10); DrawString(4, 32, STR_4010_GENERATE_RANDOM_NEW_GAME, 9); y = list_start; diff --git a/roadveh_gui.c b/roadveh_gui.c index 8ba398472..9f86e863f 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -926,7 +926,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e) /* draw sorting criteria string */ DrawString(85, 15, _vehicle_sort_listing[vl->sort_type], 0x10); /* draw arrow pointing up/down for ascending/descending sorting */ - DoDrawString(vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10); + DoDrawString(vl->flags & VL_DESC ? DOWNARROW : UPARROW, 69, 15, 0x10); max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length); for (i = w->vscroll.pos; i < max; ++i) { diff --git a/ship_gui.c b/ship_gui.c index ae7c22906..a39d94c73 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -1030,7 +1030,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e) /* draw sorting criteria string */ DrawString(85, 15, _vehicle_sort_listing[vl->sort_type], 0x10); /* draw arrow pointing up/down for ascending/descending sorting */ - DoDrawString(vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10); + DoDrawString(vl->flags & VL_DESC ? DOWNARROW : UPARROW, 69, 15, 0x10); max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length); for (i = w->vscroll.pos; i < max; ++i) { diff --git a/town_gui.c b/town_gui.c index 86794a7c7..89d7d889a 100644 --- a/town_gui.c +++ b/town_gui.c @@ -436,7 +436,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e) SetVScrollCount(w, _num_town_sort); DrawWindowWidgets(w); - DoDrawString(_town_sort_order & 1 ? "\xAA" : "\xA0", (_town_sort_order <= 1) ? 88 : 187, 15, 0x10); + DoDrawString(_town_sort_order & 1 ? DOWNARROW : UPARROW, (_town_sort_order <= 1) ? 88 : 187, 15, 0x10); { Town *t; diff --git a/train_gui.c b/train_gui.c index bc2984805..978591633 100644 --- a/train_gui.c +++ b/train_gui.c @@ -1403,7 +1403,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e) /* draw sorting criteria string */ DrawString(85, 15, _vehicle_sort_listing[vl->sort_type], 0x10); /* draw arrow pointing up/down for ascending/descending sorting */ - DoDrawString(vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10); + DoDrawString(vl->flags & VL_DESC ? DOWNARROW : UPARROW, 69, 15, 0x10); max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length); for (i = w->vscroll.pos; i < max; ++i) { diff --git a/widget.c b/widget.c index 5465ce852..3f8fc7dc2 100644 --- a/widget.c +++ b/widget.c @@ -274,11 +274,11 @@ void DrawWindowWidgets(Window *w) // draw up/down buttons clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP); DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : 0); - DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10); + DoDrawString(UPARROW, r.left + 2 + clicked, r.top + clicked, 0x10); clicked = !!(((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN)); DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); - DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); + DoDrawString(DOWNARROW, r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); c1 = _color_list[wi->color&0xF].window_color_1a; c2 = _color_list[wi->color&0xF].window_color_2; @@ -306,11 +306,11 @@ void DrawWindowWidgets(Window *w) // draw up/down buttons clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2)); DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : 0); - DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10); + DoDrawString(UPARROW, r.left + 2 + clicked, r.top + clicked, 0x10); clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2)); DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); - DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); + DoDrawString(DOWNARROW, r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10); c1 = _color_list[wi->color&0xF].window_color_1a; c2 = _color_list[wi->color&0xF].window_color_2; -- cgit v1.2.3-70-g09d2