(svn r2932) Give the strings consisting of an up/a down arrow symbolic names

This commit is contained in:
tron 2005-09-10 07:38:03 +00:00
parent 04f051e423
commit 0fe36a6900
9 changed files with 19 additions and 12 deletions

View File

@ -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) {

7
gfx.h
View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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;

View File

@ -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) {

View File

@ -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;