Changeset - r24785:0c41cd9cb4a7
[Not reviewed]
master
0 1 0
Charles Pigott - 4 years ago 2021-02-13 21:18:03
charlespigott@googlemail.com
Fix #8620: Scale spacing between date & news in history window according to font scaling
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/news_gui.cpp
Show inline comments
 
@@ -25,24 +25,25 @@
 
#include "widgets/dropdown_func.h"
 
#include "statusbar_gui.h"
 
#include "company_manager_face.h"
 
#include "company_func.h"
 
#include "engine_base.h"
 
#include "engine_gui.h"
 
#include "core/geometry_func.hpp"
 
#include "command_func.h"
 
#include "company_base.h"
 
#include "settings_internal.h"
 
#include "guitimer_func.h"
 
#include "group_gui.h"
 
#include "zoom_func.h"
 

	
 
#include "widgets/news_widget.h"
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
const NewsItem *_statusbar_news_item = nullptr;
 

	
 
static uint MIN_NEWS_AMOUNT = 30;        ///< preferred minimum amount of news messages
 
static uint MAX_NEWS_AMOUNT = 1 << 10;   ///< Do not exceed this number of news messages
 
static uint _total_news = 0;             ///< current number of news items
 
@@ -1165,26 +1166,26 @@ struct MessageHistoryWindow : Window {
 
		/* Find the first news item to display. */
 
		NewsItem *ni = _latest_news;
 
		for (int n = this->vscroll->GetPosition(); n > 0; n--) {
 
			ni = ni->prev;
 
			if (ni == nullptr) return;
 
		}
 

	
 
		/* Fill the widget with news items. */
 
		int y = r.top + this->top_spacing;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		uint date_left  = rtl ? r.right - WD_FRAMERECT_RIGHT - this->date_width : r.left + WD_FRAMERECT_LEFT;
 
		uint date_right = rtl ? r.right - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT + this->date_width;
 
		uint news_left  = rtl ? r.left + WD_FRAMERECT_LEFT : r.left + WD_FRAMERECT_LEFT + this->date_width + WD_FRAMERECT_RIGHT;
 
		uint news_right = rtl ? r.right - WD_FRAMERECT_RIGHT - this->date_width - WD_FRAMERECT_RIGHT : r.right - WD_FRAMERECT_RIGHT;
 
		uint news_left  = rtl ? r.left + WD_FRAMERECT_LEFT : r.left + WD_FRAMERECT_LEFT + this->date_width + WD_FRAMERECT_RIGHT + ScaleFontTrad(5);
 
		uint news_right = rtl ? r.right - WD_FRAMERECT_RIGHT - this->date_width - WD_FRAMERECT_RIGHT - ScaleFontTrad(5) : r.right - WD_FRAMERECT_RIGHT;
 
		for (int n = this->vscroll->GetCapacity(); n > 0; n--) {
 
			SetDParam(0, ni->date);
 
			DrawString(date_left, date_right, y, STR_SHORT_DATE);
 

	
 
			DrawNewsString(news_left, news_right, y, TC_WHITE, ni);
 
			y += this->line_height;
 

	
 
			ni = ni->prev;
 
			if (ni == nullptr) return;
 
		}
 
	}
 

	
0 comments (0 inline, 0 general)