diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/network/network_chat_gui.cpp | 10 | ||||
-rw-r--r-- | src/news_gui.cpp | 4 | ||||
-rw-r--r-- | src/statusbar_gui.cpp | 14 | ||||
-rw-r--r-- | src/window.cpp | 2 |
4 files changed, 24 insertions, 6 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index ef05ad931..1b5b13290 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -118,7 +118,7 @@ void NetworkInitChatMessage() _chatmsg_list = ReallocT(_chatmsg_list, _settings_client.gui.network_chat_box_height); _chatmsg_box.x = 10; - _chatmsg_box.y = 30; + _chatmsg_box.y = 3 * FONT_HEIGHT_NORMAL; _chatmsg_box.width = _settings_client.gui.network_chat_box_width; _chatmsg_box.height = _settings_client.gui.network_chat_box_height * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 2; _chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactoryBase::GetCurrentBlitter()->GetBytesPerPixel()); @@ -449,6 +449,12 @@ struct NetworkChatWindow : public QueryStringBaseWindow { this->DrawEditBox(NWCW_TEXTBOX); } + 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 }; + return pt; + } + virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize) { if (widget != NWCW_DESTINATION) return; @@ -537,7 +543,7 @@ static const NWidgetPart _nested_chat_window_widgets[] = { }; static const WindowDesc _chat_window_desc( - WDP_CENTER, -26, 320, 14, 640, 14, // x, y, width, height + WDP_CENTER, 0, 320, 14, 640, 14, // x, y, width, height WC_SEND_NETWORK_MSG, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, NULL, _nested_chat_window_widgets, lengthof(_nested_chat_window_widgets) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index ba27eef27..5686102f1 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -280,6 +280,7 @@ assert_compile(lengthof(_news_type_data) == NT_END); /** Window class displaying a news item. */ struct NewsWindow : Window { uint16 chat_height; ///< Height of the chat window. + uint16 status_height; ///< Height of the status bar window NewsItem *ni; ///< News item to display. static uint duration; ///< Remaining time for showing current news message (may only be accessed while a news item is displayed). @@ -288,6 +289,7 @@ struct NewsWindow : Window { NewsWindow::duration = 555; const Window *w = FindWindowById(WC_SEND_NETWORK_MSG, 0); this->chat_height = (w != NULL) ? w->height : 0; + this->status_height = FindWindowById(WC_STATUS_BAR, 0)->height; this->flags4 |= WF_DISABLE_VP_SCROLL; @@ -490,7 +492,7 @@ struct NewsWindow : Window { virtual void OnTick() { /* Scroll up newsmessages from the bottom in steps of 4 pixels */ - int y = max(this->top - 4, _screen.height - this->height - 12 - this->chat_height); + int y = max(this->top - 4, _screen.height - this->height - this->status_height - this->chat_height); if (y == this->top) return; if (this->viewport != NULL) this->viewport->top += y - this->top; diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index ac9ab4351..d8c2f3fbf 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -98,11 +98,22 @@ struct StatusBarWindow : Window { this->InitNested(desc); } + 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 }; + return pt; + } + virtual void OnPaint() { this->DrawWidgets(); } + virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize) + { + size->height = FONT_HEIGHT_NORMAL + padding.height; + } + virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { @@ -202,7 +213,7 @@ static const NWidgetPart _nested_main_status_widgets[] = { EndContainer(), }; -static WindowDesc _main_status_desc( +static const WindowDesc _main_status_desc( WDP_CENTER, 0, 320, 12, 640, 12, WC_STATUS_BAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_NO_FOCUS, @@ -220,6 +231,5 @@ bool IsNewsTickerShown() void ShowStatusBar() { - _main_status_desc.top = _screen.height - 12; new StatusBarWindow(&_main_status_desc); } diff --git a/src/window.cpp b/src/window.cpp index ff5ac700f..c2c725502 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2720,7 +2720,7 @@ void RelocateAllWindows(int neww, int newh) case WC_SEND_NETWORK_MSG: ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0); - top = (newh - 26); // 26 = height of status bar + height of chat bar + top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height; left = (neww - w->width) >> 1; break; |