File diff r16430:b3f65f9bc976 → r16431:ec558deca9d7
src/company_gui.cpp
Show inline comments
 
@@ -538,25 +538,25 @@ public:
 
	uint Height(uint width) const
 
	{
 
		return max(FONT_HEIGHT_NORMAL, (byte)14);
 
	}
 

	
 
	bool Selectable() const
 
	{
 
		return true;
 
	}
 

	
 
	void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
	{
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + this->result, rtl ? right - 16 : left + 16, top + 7);
 
		DrawString(rtl ? left + 2 : left + 32, rtl ? right - 32 : right - 2, top + max(0, 13 - FONT_HEIGHT_NORMAL), this->String(), sel ? TC_WHITE : TC_BLACK);
 
	}
 
};
 

	
 
/** Widgets of the select company livery window. */
 
enum SelectCompanyLiveryWindowWidgets {
 
	SCLW_WIDGET_CAPTION,
 
	SCLW_WIDGET_CLASS_GENERAL,
 
	SCLW_WIDGET_CLASS_RAIL,
 
	SCLW_WIDGET_CLASS_ROAD,
 
	SCLW_WIDGET_CLASS_SHIP,
 
@@ -678,25 +678,25 @@ public:
 
					if (scheme == LS_END) scheme = LS_DEFAULT;
 
				}
 
				SetDParam(0, STR_COLOUR_DARK_BLUE + ((widget == SCLW_WIDGET_PRI_COL_DROPDOWN) ? c->livery[scheme].colour1 : c->livery[scheme].colour2));
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget != SCLW_WIDGET_MATRIX) return;
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 

	
 
		/* Horizontal coordinates of scheme name column. */
 
		const NWidgetBase *nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_SPACER_DROPDOWN);
 
		int sch_left = nwi->pos_x;
 
		int sch_right = sch_left + nwi->current_x - 1;
 
		/* Horizontal coordinates of first dropdown. */
 
		nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_PRI_COL_DROPDOWN);
 
		int pri_left = nwi->pos_x;
 
		int pri_right = pri_left + nwi->current_x - 1;
 
		/* Horizontal coordinates of second dropdown. */
 
		nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_SEC_COL_DROPDOWN);
 
		int sec_left = nwi->pos_x;
 
@@ -767,25 +767,25 @@ public:
 

	
 
			case SCLW_WIDGET_MATRIX: {
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SCLW_WIDGET_MATRIX);
 
				LiveryScheme j = (LiveryScheme)((pt.y - wid->pos_y) / (4 + FONT_HEIGHT_NORMAL));
 

	
 
				for (LiveryScheme scheme = LS_BEGIN; scheme <= j; scheme++) {
 
					if (_livery_class[scheme] != this->livery_class || !HasBit(_loaded_newgrf_features.used_liveries, scheme)) j++;
 
					if (scheme >= LS_END) return;
 
				}
 
				if (j >= LS_END) return;
 

	
 
				/* If clicking on the left edge, toggle using the livery */
 
				if (_dynlang.text_dir == TD_RTL ? pt.x - wid->pos_x > wid->current_x - TEXT_INDENT : pt.x - wid->pos_x < TEXT_INDENT) {
 
				if (_current_text_dir == TD_RTL ? pt.x - wid->pos_x > wid->current_x - TEXT_INDENT : pt.x - wid->pos_x < TEXT_INDENT) {
 
					DoCommandP(0, j | (2 << 8), !Company::Get((CompanyID)this->window_number)->livery[j].in_use, CMD_SET_COMPANY_COLOUR);
 
				}
 

	
 
				if (_ctrl_pressed) {
 
					ToggleBit(this->sel, j);
 
				} else {
 
					this->sel = 1 << j;
 
				}
 
				this->SetDirty();
 
				break;
 
			}
 
		}