File diff r13693:eeeac228d9d9 → r13694:4523784084b5
src/news_gui.cpp
Show inline comments
 
@@ -92,16 +92,16 @@ enum NewsTypeWidgets {
 

	
 
/* Normal news items. */
 
static const NWidgetPart _nested_normal_news_widgets[] = {
 
	NWidget(WWT_PANEL, COLOUR_WHITE, NTW_PANEL),
 
		NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1),
 
			NWidget(WWT_TEXT, COLOUR_WHITE, NTW_CLOSEBOX), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1),
 
			NWidget(NWID_SPACER), SetFill(true, false),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_LABEL, COLOUR_WHITE, NTW_DATE), SetDataTip(STR_DATE_LONG_SMALL, STR_NULL),
 
				NWidget(NWID_SPACER), SetFill(false, true),
 
				NWidget(NWID_SPACER), SetFill(0, 1),
 
			EndContainer(),
 
		EndContainer(),
 
		NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_MESSAGE), SetMinimalSize(428, 154), SetPadding(0, 1, 1, 1),
 
	EndContainer(),
 
};
 

	
 
@@ -115,21 +115,21 @@ static WindowDesc _normal_news_desc(
 
/* New vehicles news items. */
 
static const NWidgetPart _nested_vehicle_news_widgets[] = {
 
	NWidget(WWT_PANEL, COLOUR_WHITE, NTW_PANEL),
 
		NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_TEXT, COLOUR_WHITE, NTW_CLOSEBOX), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1),
 
				NWidget(NWID_SPACER), SetFill(false, true),
 
				NWidget(NWID_SPACER), SetFill(0, 1),
 
			EndContainer(),
 
			NWidget(WWT_LABEL, COLOUR_WHITE, NTW_VEH_TITLE), SetFill(true, true), SetMinimalSize(419, 55), SetDataTip(STR_EMPTY, STR_NULL),
 
			NWidget(WWT_LABEL, COLOUR_WHITE, NTW_VEH_TITLE), SetFill(1, 1), SetMinimalSize(419, 55), SetDataTip(STR_EMPTY, STR_NULL),
 
		EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_WHITE, NTW_VEH_BKGND), SetPadding(0, 25, 1, 25),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, NTW_VEH_NAME), SetMinimalSize(369, 33), SetFill(true, false),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, NTW_VEH_SPR),  SetMinimalSize(369, 32), SetFill(true, false),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, NTW_VEH_INFO), SetMinimalSize(369, 46), SetFill(true, false),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, NTW_VEH_NAME), SetMinimalSize(369, 33), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, NTW_VEH_SPR),  SetMinimalSize(369, 32), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, NTW_VEH_INFO), SetMinimalSize(369, 46), SetFill(1, 0),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
};
 

	
 
static WindowDesc _vehicle_news_desc(
 
@@ -142,26 +142,26 @@ static WindowDesc _vehicle_news_desc(
 
/* Company news items. */
 
static const NWidgetPart _nested_company_news_widgets[] = {
 
	NWidget(WWT_PANEL, COLOUR_WHITE, NTW_PANEL),
 
		NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_TEXT, COLOUR_WHITE, NTW_CLOSEBOX), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1),
 
				NWidget(NWID_SPACER), SetFill(false, true),
 
				NWidget(NWID_SPACER), SetFill(0, 1),
 
			EndContainer(),
 
			NWidget(WWT_LABEL, COLOUR_WHITE, NTW_TITLE), SetFill(true, true), SetMinimalSize(410, 20), SetDataTip(STR_EMPTY, STR_NULL),
 
			NWidget(WWT_LABEL, COLOUR_WHITE, NTW_TITLE), SetFill(1, 1), SetMinimalSize(410, 20), SetDataTip(STR_EMPTY, STR_NULL),
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL), SetPadding(0, 1, 1, 1),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_MGR_FACE), SetMinimalSize(93, 119), SetPadding(2, 6, 2, 1),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_MGR_NAME), SetMinimalSize(93, 24), SetPadding(0, 0, 0, 1),
 
					NWidget(NWID_SPACER), SetFill(true, false),
 
					NWidget(NWID_SPACER), SetFill(1, 0),
 
				EndContainer(),
 
				NWidget(NWID_SPACER), SetFill(false, true),
 
				NWidget(NWID_SPACER), SetFill(0, 1),
 
			EndContainer(),
 
			NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_COMPANY_MSG), SetFill(true, true), SetMinimalSize(328, 150),
 
			NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_COMPANY_MSG), SetFill(1, 1), SetMinimalSize(328, 150),
 
		EndContainer(),
 
	EndContainer(),
 
};
 

	
 
static WindowDesc _company_news_desc(
 
	WDP_CENTER, 476, 430, 170,
 
@@ -172,19 +172,19 @@ static WindowDesc _company_news_desc(
 

	
 
/* Thin news items. */
 
static const NWidgetPart _nested_thin_news_widgets[] = {
 
	NWidget(WWT_PANEL, COLOUR_WHITE, NTW_PANEL),
 
		NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1),
 
			NWidget(WWT_TEXT, COLOUR_WHITE, NTW_CLOSEBOX), SetDataTip(STR_SILVER_CROSS, STR_NULL), SetPadding(0, 0, 0, 1),
 
			NWidget(NWID_SPACER), SetFill(true, false),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_LABEL, COLOUR_WHITE, NTW_DATE), SetDataTip(STR_DATE_LONG_SMALL, STR_NULL),
 
				NWidget(NWID_SPACER), SetFill(false, true),
 
				NWidget(NWID_SPACER), SetFill(0, 1),
 
			EndContainer(),
 
		EndContainer(),
 
		NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_MESSAGE), SetMinimalSize(428, 48), SetFill(true, false), SetPadding(0, 1, 0, 1),
 
		NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_MESSAGE), SetMinimalSize(428, 48), SetFill(1, 0), SetPadding(0, 1, 0, 1),
 
		NWidget(NWID_VIEWPORT, INVALID_COLOUR, NTW_VIEWPORT), SetMinimalSize(426, 70), SetPadding(1, 2, 2, 2),
 
	EndContainer(),
 
};
 

	
 
static WindowDesc _thin_news_desc(
 
	WDP_CENTER, 476, 430, 130,
 
@@ -201,15 +201,15 @@ static NWidgetPart _nested_small_news_wi
 
		NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, NTW_CAPTION), SetDataTip(STR_NEWS_MESSAGE_CAPTION, STR_NULL),
 
	EndContainer(),
 

	
 
	/* Main part */
 
	NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NTW_HEADLINE),
 
		NWidget(WWT_INSET, COLOUR_LIGHT_BLUE, NTW_INSET), SetPadding(2, 2, 2, 2),
 
			NWidget(NWID_VIEWPORT, INVALID_COLOUR, NTW_VIEWPORT), SetPadding(1, 1, 1, 1), SetMinimalSize(274, 47), SetFill(true, false),
 
			NWidget(NWID_VIEWPORT, INVALID_COLOUR, NTW_VIEWPORT), SetPadding(1, 1, 1, 1), SetMinimalSize(274, 47), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_MESSAGE), SetMinimalSize(275, 20), SetFill(true, false),
 
		NWidget(WWT_EMPTY, COLOUR_WHITE, NTW_MESSAGE), SetMinimalSize(275, 20), SetFill(1, 0),
 
	EndContainer(),
 
};
 

	
 
static WindowDesc _small_news_desc(
 
	WDP_CENTER, 476, 280, 87,
 
	WC_NEWS_WINDOW, WC_NONE,
 
@@ -1203,21 +1203,21 @@ static NWidgetBase *MakeButtonsColumn(in
 
	/* Top-part of the column, one row for each new category. */
 
	int widnum = WIDGET_NEWSOPT_START_OPTION;
 
	for (int i = 0; i < NT_END; i++) {
 
		NWidgetHorizontal *hor = new NWidgetHorizontal;
 
		/* [<] button. */
 
		NWidgetLeaf *leaf = new NWidgetLeaf(NWID_BUTTON_ARROW, COLOUR_YELLOW, widnum, AWV_DECREASE, STR_TOOLTIP_HSCROLL_BAR_SCROLLS_LIST);
 
		leaf->SetFill(true, true);
 
		leaf->SetFill(1, 1);
 
		hor->Add(leaf);
 
		/* Label. */
 
		leaf = new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_YELLOW, widnum + 1, STR_EMPTY, STR_NULL);
 
		leaf->SetFill(true, true);
 
		leaf->SetFill(1, 1);
 
		hor->Add(leaf);
 
		/* [>] button. */
 
		leaf = new NWidgetLeaf(NWID_BUTTON_ARROW, COLOUR_YELLOW, widnum + 2, AWV_INCREASE, STR_TOOLTIP_HSCROLL_BAR_SCROLLS_LIST);
 
		leaf->SetFill(true, true);
 
		leaf->SetFill(1, 1);
 
		hor->Add(leaf);
 
		vert_buttons->Add(hor);
 

	
 
		widnum += MOS_WIDG_PER_SETTING;
 
	}
 
	*biggest_index = widnum - MOS_WIDG_PER_SETTING + 2;
 
@@ -1225,17 +1225,17 @@ static NWidgetBase *MakeButtonsColumn(in
 
	/* Space between the category buttons and the global settings buttons. */
 
	NWidgetSpacer *spacer = new NWidgetSpacer(0, MOS_ABOVE_GLOBAL_SETTINGS);
 
	vert_buttons->Add(spacer);
 

	
 
	/* Bottom part of the column with buttons for global changes. */
 
	NWidgetLeaf *leaf = new NWidgetLeaf(WWT_DROPDOWN, COLOUR_YELLOW, WIDGET_NEWSOPT_DROP_SUMMARY, STR_EMPTY, STR_NULL);
 
	leaf->SetFill(true, true);
 
	leaf->SetFill(1, 1);
 
	vert_buttons->Add(leaf);
 

	
 
	leaf = new NWidgetLeaf(WWT_TEXTBTN_2, COLOUR_YELLOW, WIDGET_NEWSOPT_SOUNDTICKER, STR_STATION_BUILD_COVERAGE_OFF, STR_NULL);
 
	leaf->SetFill(true, true);
 
	leaf->SetFill(1, 1);
 
	vert_buttons->Add(leaf);
 

	
 
	*biggest_index = max(*biggest_index, max<int>(WIDGET_NEWSOPT_DROP_SUMMARY, WIDGET_NEWSOPT_SOUNDTICKER));
 
	return vert_buttons;
 
}
 

	
 
@@ -1251,13 +1251,13 @@ static NWidgetBase *MakeDescriptionColum
 

	
 
		/* Descriptive text. */
 
		NWidgetLeaf *leaf = new NWidgetLeaf(WWT_TEXT, COLOUR_YELLOW, widnum + 3, _news_type_data[i].description, STR_NULL);
 
		hor->Add(leaf);
 
		/* Filling empty space to push text to the left. */
 
		NWidgetSpacer *spacer = new NWidgetSpacer(0, 0);
 
		spacer->SetFill(true, false);
 
		spacer->SetFill(1, 0);
 
		hor->Add(spacer);
 
		vert_desc->Add(hor);
 

	
 
		widnum += MOS_WIDG_PER_SETTING;
 
	}
 
	*biggest_index = widnum - MOS_WIDG_PER_SETTING + 3;
 
@@ -1269,22 +1269,22 @@ static NWidgetBase *MakeDescriptionColum
 
	/* Bottom part of the column with descriptions of global changes. */
 
	NWidgetHorizontal *hor = new NWidgetHorizontal;
 
	NWidgetLeaf *leaf = new NWidgetLeaf(WWT_TEXT, COLOUR_YELLOW, WIDGET_NEWSOPT_LABEL_SUMMARY, STR_NEWS_MESSAGES_ALL, STR_NULL);
 
	hor->Add(leaf);
 
	/* Filling empty space to push text to the left. */
 
	spacer = new NWidgetSpacer(0, 0);
 
	spacer->SetFill(true, false);
 
	spacer->SetFill(1, 0);
 
	hor->Add(spacer);
 
	vert_desc->Add(hor);
 

	
 
	hor = new NWidgetHorizontal;
 
	leaf = new NWidgetLeaf(WWT_TEXT, COLOUR_YELLOW, WIDGET_NEWSOPT_SOUNDTICKER_LABEL, STR_NEWS_MESSAGES_SOUND, STR_NULL);
 
	hor->Add(leaf);
 
	/* Filling empty space to push text to the left. */
 
	spacer = new NWidgetSpacer(0, 0);
 
	leaf->SetFill(true, false);
 
	leaf->SetFill(1, 0);
 
	hor->Add(spacer);
 
	vert_desc->Add(hor);
 

	
 
	*biggest_index = max(*biggest_index, max<int>(WIDGET_NEWSOPT_LABEL_SUMMARY, WIDGET_NEWSOPT_SOUNDTICKER_LABEL));
 
	return vert_desc;
 
}
 
@@ -1293,15 +1293,15 @@ static const NWidgetPart _nested_message
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_BROWN, WIDGET_NEWSOPT_CLOSEBOX),
 
		NWidget(WWT_CAPTION, COLOUR_BROWN, WIDGET_NEWSOPT_CAPTION), SetDataTip(STR_NEWS_MESSAGE_OPTIONS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_BROWN, WIDGET_NEWSOPT_BACKGROUND),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetFill(true, false),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
			NWidget(WWT_LABEL, COLOUR_BROWN, WIDGET_NEWSOPT_LABEL), SetMinimalSize(0, 14), SetDataTip(STR_NEWS_MESSAGE_TYPES, STR_NULL),
 
			NWidget(NWID_SPACER), SetFill(true, false),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetMinimalSize(MOS_LEFT_EDGE, 0),
 
			NWidgetFunction(MakeButtonsColumn),
 
			NWidget(NWID_SPACER), SetMinimalSize(MOS_COLUMN_SPACING, 0),
 
			NWidgetFunction(MakeDescriptionColumn),