summaryrefslogtreecommitdiff
path: root/misc_gui.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-09 13:23:04 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-09 13:23:04 +0000
commitfd778ecafa01761e68cff310368dd035020f6b07 (patch)
tree8005097e607d7cdb0d7b03e2627fbc55efcfdd0d /misc_gui.c
parent52bab5e9bd30a5a8f20eba8a838748e3402fa87a (diff)
downloadopenttd-fd778ecafa01761e68cff310368dd035020f6b07.tar.xz
(svn r4802) - Codechange: replace _stringwidth_base and associated magic numbers with a FontSize enum, using the numbers (which are SpriteIDs) in only the places needed.
Diffstat (limited to 'misc_gui.c')
-rw-r--r--misc_gui.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/misc_gui.c b/misc_gui.c
index be6ba7ced..ac0222a55 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -768,7 +768,7 @@ void SetHScrollCount(Window *w, int num)
static void DelChar(Textbuf *tb)
{
- tb->width -= GetCharacterWidth((byte)tb->buf[tb->caretpos]);
+ tb->width -= GetCharacterWidth(FS_NORMAL, (byte)tb->buf[tb->caretpos]);
memmove(tb->buf + tb->caretpos, tb->buf + tb->caretpos + 1, tb->length - tb->caretpos);
tb->length--;
}
@@ -784,7 +784,7 @@ bool DeleteTextBufferChar(Textbuf *tb, int delmode)
{
if (delmode == WKC_BACKSPACE && tb->caretpos != 0) {
tb->caretpos--;
- tb->caretxoffs -= GetCharacterWidth((byte)tb->buf[tb->caretpos]);
+ tb->caretxoffs -= GetCharacterWidth(FS_NORMAL, (byte)tb->buf[tb->caretpos]);
DelChar(tb);
return true;
@@ -817,7 +817,7 @@ void DeleteTextBufferAll(Textbuf *tb)
*/
bool InsertTextBufferChar(Textbuf *tb, byte key)
{
- const byte charwidth = GetCharacterWidth(key);
+ const byte charwidth = GetCharacterWidth(FS_NORMAL, key);
if (tb->length < (tb->maxlength - 1) && (tb->maxwidth == 0 || tb->width + charwidth <= tb->maxwidth)) {
memmove(tb->buf + tb->caretpos + 1, tb->buf + tb->caretpos, (tb->length - tb->caretpos) + 1);
tb->buf[tb->caretpos] = key;
@@ -844,13 +844,13 @@ bool MoveTextBufferPos(Textbuf *tb, int navmode)
case WKC_LEFT:
if (tb->caretpos != 0) {
tb->caretpos--;
- tb->caretxoffs -= GetCharacterWidth((byte)tb->buf[tb->caretpos]);
+ tb->caretxoffs -= GetCharacterWidth(FS_NORMAL, (byte)tb->buf[tb->caretpos]);
return true;
}
break;
case WKC_RIGHT:
if (tb->caretpos < tb->length) {
- tb->caretxoffs += GetCharacterWidth((byte)tb->buf[tb->caretpos]);
+ tb->caretxoffs += GetCharacterWidth(FS_NORMAL, (byte)tb->buf[tb->caretpos]);
tb->caretpos++;
return true;
}
@@ -883,7 +883,7 @@ void UpdateTextBufferSize(Textbuf *tb)
for (buf = tb->buf; *buf != '\0' && tb->length < (tb->maxlength - 1); buf++) {
tb->length++;
- tb->width += GetCharacterWidth((byte)*buf);
+ tb->width += GetCharacterWidth(FS_NORMAL, (byte)*buf);
}
tb->caretpos = tb->length;