summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gfx.cpp32
-rw-r--r--src/gfx_func.h12
-rw-r--r--src/network/network_content_gui.cpp2
-rw-r--r--src/network/network_gui.cpp4
-rw-r--r--src/statusbar_gui.cpp10
-rw-r--r--src/toolbar_gui.cpp6
-rw-r--r--src/vehicle_gui.cpp2
-rw-r--r--src/widget.cpp2
8 files changed, 35 insertions, 35 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index ee6c33d0a..9ad178501 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -411,7 +411,7 @@ int DrawString(int x, int y, StringID str, TextColour colour)
* @return In case of left or center alignment the right most pixel we have drawn to.
* In case of right alignment the left most pixel we have drawn to.
*/
-static int DrawString(int left, int right, int top, char *str, const char *last, TextColour colour, TextAlignment align, bool underline = false)
+static int DrawString(int left, int right, int top, char *str, const char *last, TextColour colour, StringAlignment align, bool underline = false)
{
TruncateString(str, right - left);
HandleBiDiAndArabicShapes(str, last);
@@ -419,16 +419,16 @@ static int DrawString(int left, int right, int top, char *str, const char *last,
int w = GetStringBoundingBox(str).width;
switch (align) {
- case TA_LEFT:
+ case SA_LEFT:
right = left + w;
break;
- case TA_CENTER:
+ case SA_CENTER:
left += (right - left - w) / 2;
right = left + w;
break;
- case TA_RIGHT:
+ case SA_RIGHT:
left = right - w;
break;
@@ -440,7 +440,7 @@ static int DrawString(int left, int right, int top, char *str, const char *last,
GfxFillRect(left, top + 10, right, top + 10, _string_colourremap[1]);
}
- return align == TA_RIGHT ? left : right;
+ return align == SA_RIGHT ? left : right;
}
/**
@@ -456,7 +456,7 @@ static int DrawString(int left, int right, int top, char *str, const char *last,
* will be drawn in the right direction.
* @param underline Whether to underline what has been drawn or not.
*/
-int DrawString(int left, int right, int top, const char *str, TextColour colour, TextAlignment align, bool underline)
+int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline)
{
char buffer[DRAW_STRING_BUFFER];
strecpy(buffer, str, lastof(buffer));
@@ -476,7 +476,7 @@ int DrawString(int left, int right, int top, const char *str, TextColour colour,
* will be drawn in the right direction.
* @param underline Whether to underline what has been drawn or not.
*/
-int DrawString(int left, int right, int top, StringID str, TextColour colour, TextAlignment align, bool underline)
+int DrawString(int left, int right, int top, StringID str, TextColour colour, StringAlignment align, bool underline)
{
char buffer[DRAW_STRING_BUFFER];
GetString(buffer, str, lastof(buffer));
@@ -494,7 +494,7 @@ int DrawString(int left, int right, int top, StringID str, TextColour colour, Te
*/
int DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw)
{
- return DrawString(x, x + maxw, y, str, colour, TA_LEFT, false);
+ return DrawString(x, x + maxw, y, str, colour, SA_LEFT, false);
}
/**
@@ -507,7 +507,7 @@ int DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw
*/
int DrawStringRightAligned(int x, int y, StringID str, TextColour colour)
{
- return DrawString(0, x, y, str, colour, TA_RIGHT, false);
+ return DrawString(0, x, y, str, colour, SA_RIGHT, false);
}
/**
@@ -521,7 +521,7 @@ int DrawStringRightAligned(int x, int y, StringID str, TextColour colour)
*/
int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw)
{
- return DrawString(x - maxw, x, y, str, colour, TA_RIGHT, false);
+ return DrawString(x - maxw, x, y, str, colour, SA_RIGHT, false);
}
/**
@@ -534,7 +534,7 @@ int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colou
*/
int DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colour)
{
- return DrawString(0, x, y, str, colour, TA_RIGHT, true);
+ return DrawString(0, x, y, str, colour, SA_RIGHT, true);
}
/**
@@ -550,7 +550,7 @@ int DrawStringCentered(int x, int y, StringID str, TextColour colour)
char buffer[DRAW_STRING_BUFFER];
GetString(buffer, str, lastof(buffer));
int w = GetStringBoundingBox(buffer).width;
- return DrawString(x - w, x + w, y, buffer, lastof(buffer), colour, TA_CENTER);
+ return DrawString(x - w, x + w, y, buffer, lastof(buffer), colour, SA_CENTER);
}
/**
@@ -566,7 +566,7 @@ int DrawStringCentered(int x, int y, StringID str, TextColour colour)
*/
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, TextColour colour)
{
- return DrawString(xl, xr, y, str, colour, TA_CENTER, false);
+ return DrawString(xl, xr, y, str, colour, SA_CENTER, false);
}
/**
@@ -583,7 +583,7 @@ int DoDrawStringCentered(int x, int y, const char *str, TextColour colour)
strecpy(buffer, str, lastof(buffer));
int w = GetStringBoundingBox(buffer).width;
- return DrawString(x - w, x + w, y, buffer, lastof(buffer), colour, TA_CENTER);
+ return DrawString(x - w, x + w, y, buffer, lastof(buffer), colour, SA_CENTER);
}
/**
@@ -599,7 +599,7 @@ int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour)
char buffer[DRAW_STRING_BUFFER];
GetString(buffer, str, lastof(buffer));
int w = GetStringBoundingBox(buffer).width;
- return DrawString(x - w, y + w, y, buffer, lastof(buffer), colour, TA_CENTER, true);
+ return DrawString(x - w, y + w, y, buffer, lastof(buffer), colour, SA_CENTER, true);
}
/**
@@ -613,7 +613,7 @@ int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour)
*/
int DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, TextColour colour)
{
- return DrawString(xl, xr, y, str, colour, TA_CENTER, true);
+ return DrawString(xl, xr, y, str, colour, SA_CENTER, true);
}
/**
diff --git a/src/gfx_func.h b/src/gfx_func.h
index 91a696a5b..183045abe 100644
--- a/src/gfx_func.h
+++ b/src/gfx_func.h
@@ -86,14 +86,14 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo);
void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub = NULL);
/** How to align the to-be drawn text. */
-enum TextAlignment {
- TA_LEFT, ///< Left align the text
- TA_CENTER, ///< Center the text
- TA_RIGHT, ///< Right align the text
+enum StringAlignment {
+ SA_LEFT, ///< Left align the text
+ SA_CENTER, ///< Center the text
+ SA_RIGHT, ///< Right align the text
};
-int DrawString(int left, int right, int top, const char *str, TextColour colour, TextAlignment align = TA_LEFT, bool underline = false);
-int DrawString(int left, int right, int top, StringID str, TextColour colour, TextAlignment align = TA_LEFT, bool underline = false);
+int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align = SA_LEFT, bool underline = false);
+int DrawString(int left, int right, int top, StringID str, TextColour colour, StringAlignment align = SA_LEFT, bool underline = false);
int DrawStringCentered(int x, int y, StringID str, TextColour colour);
int DoDrawStringCentered(int x, int y, const char *str, TextColour colour);
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 3f09decfb..87f3f6dad 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -421,7 +421,7 @@ public:
DrawSprite(sprite, pal, this->widget[NCLWW_CHECKBOX].left + (pal == PAL_NONE ? 3 : 4), y + (pal == PAL_NONE ? 1 : 0));
StringID str = STR_CONTENT_TYPE_BASE_GRAPHICS + ci->type - CONTENT_TYPE_BASE_GRAPHICS;
- DrawString(this->widget[NCLWW_TYPE].left, this->widget[NCLWW_TYPE].right, y, str, TC_BLACK, TA_CENTER);
+ DrawString(this->widget[NCLWW_TYPE].left, this->widget[NCLWW_TYPE].right, y, str, TC_BLACK, SA_CENTER);
SetDParamStr(0, ci->name);
DrawStringTruncated(this->widget[NCLWW_NAME].left + 5, y, STR_JUST_RAW_STRING, TC_BLACK, this->widget[NCLWW_NAME].right - this->widget[NCLWW_NAME].left - 5);
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index a8548ea71..005034d55 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -408,10 +408,10 @@ public:
SetDParamStr(0, sel->info.server_name);
- DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE, TA_CENTER); // game name
+ DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE, SA_CENTER); // game name
SetDParamStr(0, sel->info.map_name);
- DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_JUST_RAW_STRING, TC_BLACK, TA_CENTER); // map name
+ DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_JUST_RAW_STRING, TC_BLACK, SA_CENTER); // map name
SetDParam(0, sel->info.clients_on);
SetDParam(1, sel->info.clients_max);
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp
index 0371a5de9..286fc31ce 100644
--- a/src/statusbar_gui.cpp
+++ b/src/statusbar_gui.cpp
@@ -107,11 +107,11 @@ struct StatusBarWindow : Window {
/* Draw status bar */
if (this->saving) { // true when saving is active
- DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_SAVING_GAME, TC_FROMSTRING, TA_CENTER);
+ DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_SAVING_GAME, TC_FROMSTRING, SA_CENTER);
} else if (_do_autosave) {
- DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_032F_AUTOSAVE, TC_FROMSTRING, TA_CENTER);
+ DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_032F_AUTOSAVE, TC_FROMSTRING, SA_CENTER);
} else if (_pause_game) {
- DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_0319_PAUSED, TC_FROMSTRING, TA_CENTER);
+ DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_0319_PAUSED, TC_FROMSTRING, SA_CENTER);
} else if (this->ticker_scroll > TICKER_STOP && FindWindowById(WC_NEWS_WINDOW, 0) == NULL && _statusbar_news_item.string_id != 0) {
/* Draw the scrolling news text */
if (!DrawScrollingStatusText(&_statusbar_news_item, this->ticker_scroll, this->widget[SBW_MIDDLE].right - this->widget[SBW_MIDDLE].left - 2)) {
@@ -119,14 +119,14 @@ struct StatusBarWindow : Window {
if (c != NULL) {
/* This is the default text */
SetDParam(0, c->index);
- DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING, TA_CENTER);
+ DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING, SA_CENTER);
}
}
} else {
if (c != NULL) {
/* This is the default text */
SetDParam(0, c->index);
- DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING, TA_CENTER);
+ DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING, SA_CENTER);
}
}
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 965ebb25e..5893c6eaa 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -1243,13 +1243,13 @@ public:
this->DrawWidgets();
SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
- DrawString(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING, TA_CENTER);
+ DrawString(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING, SA_CENTER);
/* We hide this panel when the toolbar space gets too small */
const Widget *panel = &this->widget[TBSE_SPACERPANEL];
if (panel->left != panel->right) {
- DrawString(panel->left + 1, panel->right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING, TA_CENTER);
- DrawString(panel->left + 1, panel->right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING, TA_CENTER);
+ DrawString(panel->left + 1, panel->right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING, SA_CENTER);
+ DrawString(panel->left + 1, panel->right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING, SA_CENTER);
}
}
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index e215e74dc..0e16bf6dd 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1938,7 +1938,7 @@ struct VehicleViewWindow : Window {
/* draw the flag plus orders */
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, 2, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1);
- DrawString(this->widget[VVW_WIDGET_START_STOP_VEH].left + 8, this->widget[VVW_WIDGET_START_STOP_VEH].right, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, TC_FROMSTRING, TA_CENTER);
+ DrawString(this->widget[VVW_WIDGET_START_STOP_VEH].left + 8, this->widget[VVW_WIDGET_START_STOP_VEH].right, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, TC_FROMSTRING, SA_CENTER);
this->DrawViewport();
}
diff --git a/src/widget.cpp b/src/widget.cpp
index 0b10ea51a..82854b7df 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -478,7 +478,7 @@ void Window::DrawWidgets() const
GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[this->owner]][4]);
}
- DrawString(r.left + 2, r.right - 2, r.top + 2, wi->data, TC_FROMSTRING, TA_CENTER);
+ DrawString(r.left + 2, r.right - 2, r.top + 2, wi->data, TC_FROMSTRING, SA_CENTER);
break;
case WWT_DROPDOWN: {