File diff r12392:a1db9214fc64 → r12393:6cdec1f68c3f
src/graph_gui.cpp
Show inline comments
 
@@ -83,23 +83,30 @@ struct GraphLegendWindow : Window {
 
		InvalidateWindow(WC_DELIVERED_CARGO, 0);
 
		InvalidateWindow(WC_PERFORMANCE_HISTORY, 0);
 
		InvalidateWindow(WC_COMPANY_VALUE, 0);
 
	}
 
};
 

	
 
static NWidgetBase *MakeNWidgetCompanyLines()
 
/**
 
 * Construct a vertical list of buttons, one for each company.
 
 * @param biggest_index Storage for collecting the biggest index used in the returned tree.
 
 * @return Panel with company buttons.
 
 * @postcond \c *biggest_index contains the largest used index in the tree.
 
 */
 
static NWidgetBase *MakeNWidgetCompanyLines(int *biggest_index)
 
{
 
	NWidgetVertical *vert = new NWidgetVertical();
 

	
 
	for (int widnum = GLW_FIRST_COMPANY; widnum <= GLW_LAST_COMPANY; widnum++) {
 
		NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum);
 
		panel->SetMinimalSize(246, 12);
 
		panel->SetFill(false, false);
 
		panel->SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION);
 
		vert->Add(panel);
 
	}
 
	*biggest_index = GLW_LAST_COMPANY;
 
	return vert;
 
}
 

	
 
static const Widget _graph_legend_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_BLACK_CROSS,       STR_TOOLTIP_CLOSE_WINDOW},           // GLW_CLOSEBOX
 
{    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   249,     0,    13, STR_GRAPH_KEY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // GLW_CAPTION
 
@@ -1192,14 +1199,18 @@ struct PerformanceRatingDetailWindow : W
 
		}
 
	}
 
};
 

	
 
CompanyID PerformanceRatingDetailWindow::company = INVALID_COMPANY;
 

	
 
/** Make a vertical list of panels for outputting score details. */
 
static NWidgetBase *MakePerformanceDetailPanels()
 
/** Make a vertical list of panels for outputting score details.
 
 * @param biggest_index Storage for collecting the biggest index used in the returned tree.
 
 * @return Panel with performance details.
 
 * @postcond \c *biggest_index contains the largest used index in the tree.
 
 */
 
static NWidgetBase *MakePerformanceDetailPanels(int *biggest_index)
 
{
 
	const StringID performance_tips[] = {
 
		STR_PERFORMANCE_DETAIL_VEHICLES_TIP,
 
		STR_PERFORMANCE_DETAIL_STATIONS_TIP,
 
		STR_PERFORMANCE_DETAIL_MIN_PROFIT_TIP,
 
		STR_PERFORMANCE_DETAIL_MIN_INCOME_TIP,
 
@@ -1218,17 +1229,23 @@ static NWidgetBase *MakePerformanceDetai
 
		NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum);
 
		panel->SetMinimalSize(299, 20);
 
		panel->SetFill(false, false);
 
		panel->SetDataTip(0x0, performance_tips[widnum - PRW_SCORE_FIRST]);
 
		vert->Add(panel);
 
	}
 
	*biggest_index = PRW_SCORE_LAST;
 
	return vert;
 
}
 

	
 
/** Make a number of rows with button-like graphics, for enabling/disabling each company. */
 
static NWidgetBase *MakeCompanyButtonRows()
 
/**
 
 * Make a number of rows with button-like graphics, for enabling/disabling each company.
 
 * @param biggest_index Storage for collecting the biggest index used in the returned tree.
 
 * @return Panel with rows of company buttons.
 
 * @postcond \c *biggest_index contains the largest used index in the tree.
 
 */
 
static NWidgetBase *MakeCompanyButtonRows(int *biggest_index)
 
{
 
	static const int MAX_LENGTH = 8; // Maximal number of company buttons in one row.
 
	NWidgetVertical *vert = NULL; // Storage for all rows.
 
	NWidgetHorizontal *hor = NULL; // Storage for buttons in one row.
 
	int hor_length = 0;
 

	
 
@@ -1249,12 +1266,13 @@ static NWidgetBase *MakeCompanyButtonRow
 
		panel->SetMinimalSize(37, 13);
 
		panel->SetFill(false, false);
 
		panel->SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION);
 
		hor->Add(panel);
 
		hor_length++;
 
	}
 
	*biggest_index = PRW_COMPANY_LAST;
 
	if (vert == NULL) return hor; // All buttons fit in a single row.
 

	
 
	if (hor_length > 0 && hor_length < MAX_LENGTH) {
 
		/* Last row is partial, add a spacer at the end to force all buttons to the left. */
 
		NWidgetSpacer *spc = new NWidgetSpacer(0, 0);
 
		spc->SetFill(true, false);