(svn r11272) -Codechange: Truncate text describing the grf file in the NewGrf settings gui
authorbelugas
Tue, 16 Oct 2007 00:35:59 +0000
changeset 7737 9d3de4ed7e60
parent 7736 0686379ea57b
child 7738 1c288fd7f2bc
(svn r11272) -Codechange: Truncate text describing the grf file in the NewGrf settings gui
src/newgrf_gui.cpp
--- a/src/newgrf_gui.cpp	Mon Oct 15 20:49:11 2007 +0000
+++ b/src/newgrf_gui.cpp	Tue Oct 16 00:35:59 2007 +0000
@@ -342,6 +342,7 @@
 				if (i >= w->vscroll.pos && i < w->vscroll.pos + w->vscroll.cap) {
 					const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename;
 					SpriteID pal;
+					byte txtoffset;
 
 					/* Pick a colour */
 					switch (c->status) {
@@ -365,7 +366,8 @@
 
 					DrawSprite(SPR_SQUARE, pal, 5, y + 2);
 					if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, 20, y + 2);
-					DoDrawString(text, c->error != NULL ? 35 : 25, y + 3, WP(w, newgrf_d).sel == c ? 0xC : 0x10);
+					txtoffset = c->error != NULL ? 35 : 25;
+					DoDrawStringTruncated(text, txtoffset, y + 3, WP(w, newgrf_d).sel == c ? 0xC : 0x10, w->width - txtoffset - 10);
 					y += 14;
 				}
 			}