(svn r22059) -Fix (r21179): Make the send chat message window follow the position of the status bar.

pull/155/head
terkhen 14 years ago
parent 1edee577e5
commit c4104567a1

@ -303,6 +303,8 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
this->SetFocusedWidget(NWCW_TEXTBOX);
InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
_chat_tab_completion_active = false;
PositionNetworkChatWindow(this);
}
~NetworkChatWindow()
@ -457,7 +459,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
{
Point pt = { (_screen.width - max(sm_width, desc->default_width)) / 2, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
return pt;
}

@ -693,6 +693,7 @@ static bool v_PositionStatusbar(int32 p1)
if (_game_mode != GM_MENU) {
PositionStatusbar(NULL);
PositionNewsMessage(NULL);
PositionNetworkChatWindow(NULL);
}
return true;
}

@ -2675,6 +2675,17 @@ int PositionNewsMessage(Window *w)
return PositionWindow(w, WC_NEWS_WINDOW, _settings_client.gui.statusbar_pos);
}
/**
* (Re)position network chat window at the screen.
* @param w Window structure of the network chat window, may also be \c NULL.
* @return X coordinate of left edge of the repositioned network chat winodw.
*/
int PositionNetworkChatWindow(Window *w)
{
DEBUG(misc, 5, "Repositioning network chat window...");
return PositionWindow(w, WC_SEND_NETWORK_MSG, _settings_client.gui.statusbar_pos);
}
/**
* Switches viewports following vehicles, which get autoreplaced
@ -2739,7 +2750,7 @@ void RelocateAllWindows(int neww, int newh)
case WC_SEND_NETWORK_MSG:
ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0);
top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height;
left = (neww - w->width) >> 1;
left = PositionNetworkChatWindow(w);
break;
case WC_CONSOLE:

@ -23,6 +23,7 @@ void ResizeWindow(Window *w, int x, int y);
int PositionMainToolbar(Window *w);
int PositionStatusbar(Window *w);
int PositionNewsMessage(Window *w);
int PositionNetworkChatWindow(Window *w);
int GetMainViewTop();
int GetMainViewBottom();

Loading…
Cancel
Save