mirror of https://github.com/OpenTTD/OpenTTD
(svn r22059) -Fix (r21179): Make the send chat message window follow the position of the status bar.
parent
b187352663
commit
8196b03074
|
@ -303,6 +303,8 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||||
this->SetFocusedWidget(NWCW_TEXTBOX);
|
this->SetFocusedWidget(NWCW_TEXTBOX);
|
||||||
InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
|
InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
|
||||||
_chat_tab_completion_active = false;
|
_chat_tab_completion_active = false;
|
||||||
|
|
||||||
|
PositionNetworkChatWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
~NetworkChatWindow()
|
~NetworkChatWindow()
|
||||||
|
@ -457,7 +459,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||||
|
|
||||||
virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
|
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;
|
return pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -693,6 +693,7 @@ static bool v_PositionStatusbar(int32 p1)
|
||||||
if (_game_mode != GM_MENU) {
|
if (_game_mode != GM_MENU) {
|
||||||
PositionStatusbar(NULL);
|
PositionStatusbar(NULL);
|
||||||
PositionNewsMessage(NULL);
|
PositionNewsMessage(NULL);
|
||||||
|
PositionNetworkChatWindow(NULL);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2675,6 +2675,17 @@ int PositionNewsMessage(Window *w)
|
||||||
return PositionWindow(w, WC_NEWS_WINDOW, _settings_client.gui.statusbar_pos);
|
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
|
* Switches viewports following vehicles, which get autoreplaced
|
||||||
|
@ -2739,7 +2750,7 @@ void RelocateAllWindows(int neww, int newh)
|
||||||
case WC_SEND_NETWORK_MSG:
|
case WC_SEND_NETWORK_MSG:
|
||||||
ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0);
|
ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0);
|
||||||
top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height;
|
top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height;
|
||||||
left = (neww - w->width) >> 1;
|
left = PositionNetworkChatWindow(w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WC_CONSOLE:
|
case WC_CONSOLE:
|
||||||
|
|
|
@ -23,6 +23,7 @@ void ResizeWindow(Window *w, int x, int y);
|
||||||
int PositionMainToolbar(Window *w);
|
int PositionMainToolbar(Window *w);
|
||||||
int PositionStatusbar(Window *w);
|
int PositionStatusbar(Window *w);
|
||||||
int PositionNewsMessage(Window *w);
|
int PositionNewsMessage(Window *w);
|
||||||
|
int PositionNetworkChatWindow(Window *w);
|
||||||
|
|
||||||
int GetMainViewTop();
|
int GetMainViewTop();
|
||||||
int GetMainViewBottom();
|
int GetMainViewBottom();
|
||||||
|
|
Loading…
Reference in New Issue