File diff r13023:9f6499c8d4fb → r13024:48c81d0b078a
src/graph_gui.cpp
Show inline comments
 
@@ -78,29 +78,29 @@ struct GraphLegendWindow : Window {
 
		SetDParam(0, cid);
 
		SetDParam(1, cid);
 
		DrawString(r.left + 19, r.right - 2, r.top + 1, STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		if (!IsInsideMM(widget, GLW_FIRST_COMPANY, MAX_COMPANIES + GLW_FIRST_COMPANY)) return;
 

	
 
		ToggleBit(_legend_excluded_companies, widget - GLW_FIRST_COMPANY);
 
		this->ToggleWidgetLoweredState(widget);
 
		this->SetDirty();
 
		InvalidateWindow(WC_INCOME_GRAPH, 0);
 
		InvalidateWindow(WC_OPERATING_PROFIT, 0);
 
		InvalidateWindow(WC_DELIVERED_CARGO, 0);
 
		InvalidateWindow(WC_PERFORMANCE_HISTORY, 0);
 
		InvalidateWindow(WC_COMPANY_VALUE, 0);
 
		SetWindowDirty(WC_INCOME_GRAPH, 0);
 
		SetWindowDirty(WC_OPERATING_PROFIT, 0);
 
		SetWindowDirty(WC_DELIVERED_CARGO, 0);
 
		SetWindowDirty(WC_PERFORMANCE_HISTORY, 0);
 
		SetWindowDirty(WC_COMPANY_VALUE, 0);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		if (Company::IsValidID(data)) return;
 

	
 
		SetBit(_legend_excluded_companies, data);
 
		this->RaiseWidget(data + GLW_FIRST_COMPANY);
 
	}
 
};
 

	
 
/**
 
@@ -394,25 +394,25 @@ protected:
 
					x += GRAPH_X_POSITION_SEPARATION;
 
				}
 
			}
 
		}
 
	}
 

	
 

	
 
	BaseGraphWindow(const WindowDesc *desc, WindowNumber window_number, int left,
 
									int top, int height, bool has_negative_values, StringID format_str_y_axis) :
 
			Window(desc, window_number), has_negative_values(has_negative_values),
 
			format_str_y_axis(format_str_y_axis)
 
	{
 
		InvalidateWindow(WC_GRAPH_LEGEND, 0);
 
		SetWindowDirty(WC_GRAPH_LEGEND, 0);
 
		this->num_vert_lines = 24;
 

	
 
		this->graph_location.left   = left;
 
		this->graph_location.right  = left + GRAPH_X_POSITION_BEGINNING + this->num_vert_lines * GRAPH_X_POSITION_SEPARATION - 1;
 

	
 
		this->graph_location.top    = top;
 
		this->graph_location.bottom = top + height - 1;
 
	}
 

	
 
	void InitializeWindow(const WindowDesc *desc)
 
	{
 
		this->FindWindowPlacementAndResize(desc);