From 7a7e7c82cf54f86f8144b99949d564d172f1a8a8 Mon Sep 17 00:00:00 2001 From: tron Date: Fri, 7 Apr 2006 08:57:03 +0000 Subject: [PATCH] (svn r4312) Calculate the maximum pixel width of the entered text in the chat box from the "text box"-widget instead of hardcoding an arbitrary - and wrong - number --- gui.h | 2 +- main_gui.c | 2 +- network_gui.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gui.h b/gui.h index 6b077fe520..568e350e34 100644 --- a/gui.h +++ b/gui.h @@ -124,7 +124,7 @@ extern const byte _fios_colors[]; /* network gui */ void ShowNetworkGameWindow(void); -void ShowChatWindow(int maxlen, int maxwidth, WindowClass window_class, WindowNumber window_number); +void ShowChatWindow(int maxlen, WindowClass window_class, WindowNumber window_number); /* bridge_gui.c */ void ShowBuildBridgeWindow(uint start, uint end, byte type); diff --git a/main_gui.c b/main_gui.c index 9fdc1d4e3b..14b4b49601 100644 --- a/main_gui.c +++ b/main_gui.c @@ -332,7 +332,7 @@ void ShowNetworkChatQueryWindow(byte desttype, byte dest) { _rename_id = desttype + (dest << 8); _rename_what = 2; - ShowChatWindow(150, 338, 1, 0); + ShowChatWindow(150, 1, 0); } void ShowNetworkGiveMoneyWindow(byte player) diff --git a/network_gui.c b/network_gui.c index c29151d804..4d089c01de 100644 --- a/network_gui.c +++ b/network_gui.c @@ -1545,7 +1545,7 @@ static const WindowDesc _chat_window_desc = { ChatWindowWndProc }; -void ShowChatWindow(int maxlen, int maxwidth, WindowClass window_class, WindowNumber window_number) +void ShowChatWindow(int maxlen, WindowClass window_class, WindowNumber window_number) { Window *w; @@ -1561,7 +1561,7 @@ void ShowChatWindow(int maxlen, int maxwidth, WindowClass window_class, WindowNu WP(w,querystr_d).wnd_num = window_number; WP(w,querystr_d).text.caret = false; WP(w,querystr_d).text.maxlength = maxlen; - WP(w,querystr_d).text.maxwidth = maxwidth; + WP(w,querystr_d).text.maxwidth = w->widget[1].right - w->widget[1].left - 2; // widget[1] is the "text box" WP(w,querystr_d).text.buf = _edit_str_buf; UpdateTextBufferSize(&WP(w, querystr_d).text); }