Changeset - r16431:ec558deca9d7
[Not reviewed]
src/ai/ai_gui.cpp
Show inline comments
 
@@ -287,13 +287,13 @@ struct AISettingsWindow : public Window 
 

	
 
		AIConfig *config = this->ai_config;
 
		AIConfigItemList::const_iterator it = config->GetConfigList()->begin();
 
		int i = 0;
 
		for (; !this->vscroll->IsVisible(i); i++) it++;
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		uint buttons_left = rtl ? r.right - 23 : r.left + 4;
 
		uint text_left    = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
 
		uint text_right   = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
 

	
 

	
 
		int y = r.top;
 
@@ -357,13 +357,13 @@ struct AISettingsWindow : public Window 
 
				AIConfigItem config_item = *it;
 
				if (_game_mode != GM_MENU && (config_item.flags & AICONFIG_INGAME) == 0) return;
 

	
 
				bool bool_item = (config_item.flags & AICONFIG_BOOLEAN) != 0;
 

	
 
				int x = pt.x - wid->pos_x;
 
				if (_dynlang.text_dir == TD_RTL) x = wid->current_x - x;
 
				if (_current_text_dir == TD_RTL) x = wid->current_x - x;
 
				x -= 4;
 
				/* One of the arrows is clicked (or green/red rect in case of bool value) */
 
				if (IsInsideMM(x, 0, 21)) {
 
					int new_val = this->ai_config->GetSetting(config_item.name);
 
					if (bool_item) {
 
						new_val = !new_val;
src/aircraft_gui.cpp
Show inline comments
 
@@ -75,13 +75,13 @@ void DrawAircraftDetails(const Aircraft 
 
 * @param right     The maximum horizontal position
 
 * @param y         Vertical position to draw at
 
 * @param selection Selected vehicle to draw a frame around
 
 */
 
void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
 
{
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 

	
 
	SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W);
 
	const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
 

	
 
	int x = rtl ? right - real_sprite->width - real_sprite->x_offs : left - real_sprite->x_offs;
 
	bool helicopter = v->subtype == AIR_HELICOPTER;
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -839,13 +839,13 @@ void DrawEngineList(VehicleType type, in
 

	
 
	/* Obligatory sanity checks! */
 
	assert((uint)type < lengthof(sprite_widths));
 
	assert_compile(lengthof(sprite_y_offsets) == lengthof(sprite_widths));
 
	assert(max <= eng_list->Length());
 

	
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 
	int step_size = GetEngineListHeight(type);
 
	int sprite_width = sprite_widths[type];
 

	
 
	int sprite_x        = (rtl ? r - sprite_width / 2 : l + sprite_width / 2) - 1;
 
	int sprite_y_offset = sprite_y_offsets[type] + step_size / 2;
 

	
src/cheat_gui.cpp
Show inline comments
 
@@ -160,13 +160,13 @@ struct CheatWindow : Window {
 
	{
 
		if (widget != CW_PANEL) return;
 

	
 
		int y = r.top + WD_FRAMERECT_TOP + this->header_height;
 
		DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, y, STR_CHEATS_WARNING, TC_FROMSTRING, SA_CENTER);
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		uint box_left    = rtl ? r.right - 12 : r.left + 5;
 
		uint button_left = rtl ? r.right - 40 : r.left + 20;
 
		uint text_left   = r.left + (rtl ? WD_FRAMERECT_LEFT: 50);
 
		uint text_right  = r.right - (rtl ? 50 : WD_FRAMERECT_RIGHT);
 

	
 
		for (int i = 0; i != lengthof(_cheats_ui); i++) {
 
@@ -277,13 +277,13 @@ struct CheatWindow : Window {
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL);
 
		uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL);
 
		uint x = pt.x - wid->pos_x;
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		if (rtl) x = wid->current_x - x;
 

	
 
		/* Not clicking a button? */
 
		if (!IsInsideMM(x, 20, 40) || btn >= lengthof(_cheats_ui)) return;
 

	
 
		const CheatEntry *ce = &_cheats_ui[btn];
src/company_gui.cpp
Show inline comments
 
@@ -544,13 +544,13 @@ public:
 
	{
 
		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. */
 
@@ -684,13 +684,13 @@ public:
 
	}
 

	
 
	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. */
 
@@ -773,13 +773,13 @@ public:
 
					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 {
src/depot_gui.cpp
Show inline comments
 
@@ -270,13 +270,13 @@ struct DepotWindow : Window {
 
	 */
 
	void DrawVehicleInDepot(const Vehicle *v, int left, int right, int y) const
 
	{
 
		bool free_wagon = false;
 
		int sprite_y = y + (this->resize.step_height - GetVehicleHeight(v->type)) / 2;
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		int image_left  = rtl ? left  + this->count_width  : left  + this->header_width;
 
		int image_right = rtl ? right - this->header_width : right - this->count_width;
 

	
 
		switch (v->type) {
 
			case VEH_TRAIN: {
 
				const Train *u = Train::From(v);
 
@@ -328,13 +328,13 @@ struct DepotWindow : Window {
 
	}
 

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

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

	
 
		/* Set the row and number of boxes in each row based on the number of boxes drawn in the matrix */
 
		uint16 mat_data = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->widget_data;
 
		uint16 rows_in_display   = GB(mat_data, MAT_ROW_START, MAT_ROW_BITS);
 
		uint16 boxes_in_each_row = GB(mat_data, MAT_COL_START, MAT_COL_BITS);
 

	
 
@@ -386,13 +386,13 @@ struct DepotWindow : Window {
 
	};
 

	
 
	DepotGUIAction GetVehicleFromDepotWndPt(int x, int y, const Vehicle **veh, GetDepotVehiclePtData *d) const
 
	{
 
		const NWidgetCore *matrix_widget = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX);
 
		/* In case of RTL the widgets are swapped as a whole */
 
		if (_dynlang.text_dir == TD_RTL) x = matrix_widget->current_x - x;
 
		if (_current_text_dir == TD_RTL) x = matrix_widget->current_x - x;
 

	
 
		uint xt = 0, xm = 0, ym = 0;
 
		if (this->type == VEH_TRAIN) {
 
			xm = x;
 
		} else {
 
			xt = x / this->resize.step_width;
src/gfx.cpp
Show inline comments
 
@@ -343,13 +343,13 @@ static UChar *HandleBiDiAndArabicShapes(
 
	input_output[length] = 0;
 

	
 
	UErrorCode err = U_ZERO_ERROR;
 
	UBiDi *para = ubidi_openSized((int32_t)length, 0, &err);
 
	if (para == NULL) return buffer;
 

	
 
	ubidi_setPara(para, input_output, (int32_t)length, _dynlang.text_dir == TD_RTL ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, NULL, &err);
 
	ubidi_setPara(para, input_output, (int32_t)length, _current_text_dir == TD_RTL ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, NULL, &err);
 
	ubidi_writeReordered(para, intermediate, (int32_t)length, UBIDI_REMOVE_BIDI_CONTROLS, &err);
 
	length = u_shapeArabic(intermediate, (int32_t)length, input_output, lengthof(input_output), U_SHAPE_TEXT_DIRECTION_VISUAL_LTR | U_SHAPE_LETTERS_SHAPE, &err);
 
	ubidi_close(para);
 

	
 
	if (U_FAILURE(err)) return buffer;
 

	
 
@@ -552,13 +552,13 @@ static int DrawString(int left, int righ
 
		*p++ = *loc++;
 
		/* ... and finally copy the y coordinate if it exists */
 
		if (c == SCC_SETXY) *p++ = *loc++;
 
	}
 

	
 
	/* In case we have a RTL language we swap the alignment. */
 
	if (!(align & SA_FORCE) && _dynlang.text_dir == TD_RTL && !(align & SA_STRIP) && (align & SA_HOR_MASK) != SA_HOR_CENTER) align ^= SA_RIGHT;
 
	if (!(align & SA_FORCE) && _current_text_dir == TD_RTL && !(align & SA_STRIP) && (align & SA_HOR_MASK) != SA_HOR_CENTER) align ^= SA_RIGHT;
 

	
 
	for (UChar **iter = setx_offsets.Begin(); iter != setx_offsets.End(); iter++) {
 
		UChar *to_draw = *iter;
 
		int offset = 0;
 

	
 
		/* Skip the SETX(Y) and set the appropriate offsets. */
src/graph_gui.cpp
Show inline comments
 
@@ -71,13 +71,13 @@ struct GraphLegendWindow : Window {
 
		if (!IsInsideMM(widget, GLW_FIRST_COMPANY, MAX_COMPANIES + GLW_FIRST_COMPANY)) return;
 

	
 
		CompanyID cid = (CompanyID)(widget - GLW_FIRST_COMPANY);
 

	
 
		if (!Company::IsValidID(cid)) return;
 

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

	
 
		DrawCompanyIcon(cid, rtl ? r.right - 16 : r.left + 2, r.top + 2 + (FONT_HEIGHT_NORMAL - 10) / 2);
 

	
 
		SetDParam(0, cid);
 
		SetDParam(1, cid);
 
		DrawString(r.left + (rtl ? WD_FRAMERECT_LEFT : 19), r.right - (rtl ? 19 : WD_FRAMERECT_RIGHT), r.top + WD_FRAMERECT_TOP, STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
 
@@ -961,13 +961,13 @@ struct PaymentRatesGraphWindow : BaseGra
 
		if (widget < CPW_CARGO_FIRST) {
 
			BaseGraphWindow::DrawWidget(r, widget);
 
			return;
 
		}
 

	
 
		const CargoSpec *cs = _sorted_cargo_specs[widget - CPW_CARGO_FIRST];
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 

	
 
		/* Since the buttons have no text, no images,
 
		 * both the text and the coloured box have to be manually painted.
 
		 * clk_dif will move one pixel down and one pixel to the right
 
		 * when the button is clicked */
 
		byte clk_dif = this->IsWidgetLowered(widget) ? 1 : 0;
 
@@ -1193,13 +1193,13 @@ public:
 
	{
 
		if (widget != CLW_BACKGROUND) return;
 

	
 
		uint y = r.top + WD_FRAMERECT_TOP;
 
		int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - 10) / 2;
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		uint ordinal_left  = rtl ? r.right - WD_FRAMERECT_LEFT - this->ordinal_width : r.left + WD_FRAMERECT_LEFT;
 
		uint ordinal_right = rtl ? r.right - WD_FRAMERECT_LEFT : r.left + WD_FRAMERECT_LEFT + this->ordinal_width;
 
		uint icon_left     = r.left + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT + (rtl ? this->text_width : this->ordinal_width);
 
		uint text_left     = rtl ? r.left + WD_FRAMERECT_LEFT : r.right - WD_FRAMERECT_LEFT - this->text_width;
 
		uint text_right    = rtl ? r.left + WD_FRAMERECT_LEFT + this->text_width : r.right - WD_FRAMERECT_LEFT;
 

	
 
@@ -1378,13 +1378,13 @@ struct PerformanceRatingDetailWindow : W
 
				uint score_detail_width = GetStringBoundingBox(STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY).width;
 

	
 
				size->width = 7 + score_info_width + 5 + this->bar_width + 5 + score_detail_width + 7;
 
				uint left  = 7;
 
				uint right = size->width - 7;
 

	
 
				bool rtl = _dynlang.text_dir == TD_RTL;
 
				bool rtl = _current_text_dir == TD_RTL;
 
				this->score_info_left  = rtl ? right - score_info_width : left;
 
				this->score_info_right = rtl ? right : left + score_info_width;
 

	
 
				this->score_detail_left  = rtl ? left : right - score_detail_width;
 
				this->score_detail_right = rtl ? left + score_detail_width : right;
 

	
 
@@ -1441,13 +1441,13 @@ struct PerformanceRatingDetailWindow : W
 
		/* Draw the score */
 
		SetDParam(0, score);
 
		DrawString(this->score_info_left, this->score_info_right, text_top, STR_BLACK_COMMA, TC_FROMSTRING, SA_RIGHT);
 

	
 
		/* Calculate the %-bar */
 
		uint x = Clamp(val, 0, needed) * this->bar_width / needed;
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		if (rtl) {
 
			x = this->bar_right - x;
 
		} else {
 
			x = this->bar_left + x;
 
		}
 

	
src/industry_gui.cpp
Show inline comments
 
@@ -1651,13 +1651,13 @@ struct CargoesField {
 
					const IndustrySpec *indsp = GetIndustrySpec(this->u.industry.ind_type);
 
					SetDParam(0, indsp->name);
 
					DrawString(xpos, xpos2, ypos, STR_JUST_STRING, TC_WHITE, SA_HOR_CENTER);
 

	
 
					/* Draw the industry legend. */
 
					int blob_left, blob_right;
 
					if (_dynlang.text_dir == TD_RTL) {
 
					if (_current_text_dir == TD_RTL) {
 
						blob_right = xpos2 - BLOB_DISTANCE;
 
						blob_left  = blob_right - BLOB_WIDTH;
 
					} else {
 
						blob_left  = xpos + BLOB_DISTANCE;
 
						blob_right = blob_left + BLOB_WIDTH;
 
					}
 
@@ -1666,13 +1666,13 @@ struct CargoesField {
 
				} else {
 
					DrawString(xpos, xpos2, ypos, STR_INDUSTRY_CARGOES_HOUSES, TC_FROMSTRING, SA_HOR_CENTER);
 
				}
 

	
 
				/* Draw the other_produced/other_accepted cargoes. */
 
				const CargoID *other_right, *other_left;
 
				if (_dynlang.text_dir == TD_RTL) {
 
				if (_current_text_dir == TD_RTL) {
 
					other_right = this->u.industry.other_accepted;
 
					other_left  = this->u.industry.other_produced;
 
				} else {
 
					other_right = this->u.industry.other_produced;
 
					other_left  = this->u.industry.other_accepted;
 
				}
 
@@ -1710,13 +1710,13 @@ struct CargoesField {
 
					colpos += HOR_CARGO_WIDTH - 2;
 
					GfxDrawLine(colpos, top, colpos, bot, CARGO_LINE_COLOUR);
 
					colpos += 1 + HOR_CARGO_SPACE;
 
				}
 

	
 
				const CargoID *hor_left, *hor_right;
 
				if (_dynlang.text_dir == TD_RTL) {
 
				if (_current_text_dir == TD_RTL) {
 
					hor_left  = this->u.cargo.cust_cargoes;
 
					hor_right = this->u.cargo.supp_cargoes;
 
				} else {
 
					hor_left  = this->u.cargo.supp_cargoes;
 
					hor_right = this->u.cargo.cust_cargoes;
 
				}
 
@@ -2431,13 +2431,13 @@ struct IndustryCargoesWindow : public Wi
 
		int vpos = -this->vscroll->GetPosition() * nwp->resize_y;
 
		for (uint i = 0; i < this->fields.Length(); i++) {
 
			int row_height = (i == 0) ? CargoesField::small_height : CargoesField::normal_height;
 
			if (vpos + row_height >= 0) {
 
				int xpos = left_pos;
 
				int col, dir;
 
				if (_dynlang.text_dir == TD_RTL) {
 
				if (_current_text_dir == TD_RTL) {
 
					col = last_column;
 
					dir = -1;
 
				} else {
 
					col = 0;
 
					dir = 1;
 
				}
 
@@ -2487,13 +2487,13 @@ struct IndustryCargoesWindow : public Wi
 
		if (column > num_columns) return false;
 
		xpos = pt.x - xpos;
 

	
 
		/* Return both positions, compensating for RTL languages (which works due to the equal symmetry in both displays). */
 
		fieldxy->y = row;
 
		xy->y = vpos;
 
		if (_dynlang.text_dir == TD_RTL) {
 
		if (_current_text_dir == TD_RTL) {
 
			fieldxy->x = num_columns - column;
 
			xy->x = ((column & 1) ? CargoesField::CARGO_FIELD_WIDTH : CargoesField::industry_width) - xpos;
 
		} else {
 
			fieldxy->x = column;
 
			xy->x = xpos;
 
		}
src/music_gui.cpp
Show inline comments
 
@@ -577,15 +577,15 @@ struct MusicWindow : public Window {
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 

	
 
			/* Hack-ish: set the proper widget data; only needs to be done once
 
			 * per (Re)Init as that's the only time the language changes. */
 
			case MW_PREV: this->GetWidget<NWidgetCore>(MW_PREV)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break;
 
			case MW_NEXT: this->GetWidget<NWidgetCore>(MW_NEXT)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break;
 
			case MW_PLAY: this->GetWidget<NWidgetCore>(MW_PLAY)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break;
 
			case MW_PREV: this->GetWidget<NWidgetCore>(MW_PREV)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break;
 
			case MW_NEXT: this->GetWidget<NWidgetCore>(MW_NEXT)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break;
 
			case MW_PLAY: this->GetWidget<NWidgetCore>(MW_PLAY)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break;
 
		}
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
@@ -628,13 +628,13 @@ struct MusicWindow : public Window {
 
			}
 

	
 
			case MW_MUSIC_VOL: case MW_EFFECT_VOL: {
 
				DrawFrameRect(r.left, r.top + 2, r.right, r.bottom - 2, COLOUR_GREY, FR_LOWERED);
 
				byte volume = (widget == MW_MUSIC_VOL) ? msf.music_vol : msf.effect_vol;
 
				int x = (volume * (r.right - r.left) / 127);
 
				if (_dynlang.text_dir == TD_RTL) {
 
				if (_current_text_dir == TD_RTL) {
 
					x = r.right - x;
 
				} else {
 
					x += r.left;
 
				}
 
				DrawFrameRect(x, r.top, x + slider_width, r.bottom, COLOUR_GREY, FR_NONE);
 
				break;
 
@@ -681,13 +681,13 @@ struct MusicWindow : public Window {
 
			case MW_MUSIC_VOL: case MW_EFFECT_VOL: { // volume sliders
 
				int x = pt.x - this->GetWidget<NWidgetBase>(widget)->pos_x;
 

	
 
				byte *vol = (widget == MW_MUSIC_VOL) ? &msf.music_vol : &msf.effect_vol;
 

	
 
				byte new_vol = x * 127 / this->GetWidget<NWidgetBase>(widget)->current_x;
 
				if (_dynlang.text_dir == TD_RTL) new_vol = 127 - new_vol;
 
				if (_current_text_dir == TD_RTL) new_vol = 127 - new_vol;
 
				if (new_vol != *vol) {
 
					*vol = new_vol;
 
					if (widget == MW_MUSIC_VOL) MusicVolumeChanged(new_vol);
 
					this->SetDirty();
 
				}
 

	
src/network/network.cpp
Show inline comments
 
@@ -204,13 +204,13 @@ void NetworkTextMessage(NetworkAction ac
 
	SetDParam(2, data);
 

	
 
	/* All of these strings start with "***". These characters are interpreted as both left-to-right and
 
	 * right-to-left characters depending on the context. As the next text might be an user's name, the
 
	 * user name's characters will influence the direction of the "***" instead of the language setting
 
	 * of the game. Manually set the direction of the "***" by inserting a text-direction marker. */
 
	char *msg_ptr = message + Utf8Encode(message, _dynlang.text_dir == TD_LTR ? CHAR_TD_LRM : CHAR_TD_RLM);
 
	char *msg_ptr = message + Utf8Encode(message, _current_text_dir == TD_LTR ? CHAR_TD_LRM : CHAR_TD_RLM);
 
	GetString(msg_ptr, strid, lastof(message));
 

	
 
	DEBUG(desync, 1, "msg: %08x; %02x; %s", _date, _date_fract, message);
 
	IConsolePrintF(colour, "%s", message);
 
	NetworkAddChatMessage((TextColour)colour, duration, "%s", message);
 
}
src/network/network_gui.cpp
Show inline comments
 
@@ -1540,13 +1540,13 @@ struct NetworkLobbyWindow : public Windo
 
		/* Draw window widgets */
 
		this->DrawWidgets();
 
	}
 

	
 
	void DrawMatrix(const Rect &r) const
 
	{
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		uint left = r.left + WD_FRAMERECT_LEFT;
 
		uint right = r.right - WD_FRAMERECT_RIGHT;
 

	
 
		Dimension lock_size = GetSpriteSize(SPR_LOCK);
 
		int lock_width      = lock_size.width;
 
		int lock_y_offset   = (this->resize.step_height - WD_MATRIX_TOP - WD_MATRIX_BOTTOM - lock_size.height) / 2;
 
@@ -2061,13 +2061,13 @@ struct NetworkClientListWindow : Window 
 
	}
 

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

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - 10) / 2;
 
		uint y = r.top + WD_FRAMERECT_TOP;
 
		uint left = r.left + WD_FRAMERECT_LEFT;
 
		uint right = r.right - WD_FRAMERECT_RIGHT;
 
		uint type_icon_width = this->server_client_width + this->company_icon_width;
 

	
src/newgrf_gui.cpp
Show inline comments
 
@@ -240,13 +240,13 @@ struct NewGRFParametersWindow : public W
 
			DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_TEXTPANEL_TOP, r.bottom - WD_TEXTPANEL_BOTTOM, desc, TC_BLACK);
 
			return;
 
		} else if (widget != GRFPAR_WIDGET_BACKGROUND) {
 
			return;
 
		}
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		uint buttons_left = rtl ? r.right - 23 : r.left + 4;
 
		uint text_left    = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
 
		uint text_right   = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
 

	
 
		int y = r.top;
 
		for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < this->vscroll->GetCount(); i++) {
 
@@ -313,13 +313,13 @@ struct NewGRFParametersWindow : public W
 
					DeleteChildWindows(WC_QUERY_STRING);
 
					this->clicked_row = num;
 
				}
 

	
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(GRFPAR_WIDGET_BACKGROUND);
 
				int x = pt.x - wid->pos_x;
 
				if (_dynlang.text_dir == TD_RTL) x = wid->current_x - x;
 
				if (_current_text_dir == TD_RTL) x = wid->current_x - x;
 
				x -= 4;
 

	
 
				GRFParameterInfo *par_info = (num < this->grf_config->param_info.Length()) ? this->grf_config->param_info[num] : NULL;
 
				if (par_info == NULL) par_info = GetDummyParameterInfo(num);
 

	
 
				/* One of the arrows is clicked */
 
@@ -697,13 +697,13 @@ struct NewGRFWindow : public QueryString
 

	
 
				uint step_height = this->GetWidget<NWidgetBase>(SNGRFS_FILE_LIST)->resize_y;
 
				uint y = r.top + WD_FRAMERECT_TOP;
 
				int sprite_offset_y = (step_height - 10) / 2;
 
				int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
 

	
 
				bool rtl = _dynlang.text_dir == TD_RTL;
 
				bool rtl = _current_text_dir == TD_RTL;
 
				uint text_left    = rtl ? r.left + WD_FRAMERECT_LEFT : r.left + 25;
 
				uint text_right   = rtl ? r.right - 25 : r.right - WD_FRAMERECT_RIGHT;
 
				uint square_left  = rtl ? r.right - 15 : r.left + 5;
 
				uint warning_left = rtl ? r.right - 30 : r.left + 20;
 

	
 
				int i = 0;
src/news_gui.cpp
Show inline comments
 
@@ -991,13 +991,13 @@ struct MessageHistoryWindow : Window {
 
			ni = ni->prev;
 
			if (ni == NULL) return;
 
		}
 

	
 
		/* Fill the widget with news items. */
 
		int y = r.top + this->top_spacing;
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		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;
 
		for (int n = this->vscroll->GetCapacity(); n > 0; n--) {
 
			SetDParam(0, ni->date);
src/order_gui.cpp
Show inline comments
 
@@ -185,13 +185,13 @@ static int DepotActionStringIndex(const 
 
 * @param left Left border for text drawing
 
 * @param middle X position between order index and order text
 
 * @param right Right border for text drawing
 
 */
 
void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int middle, int right)
 
{
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 

	
 
	SpriteID sprite = rtl ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT;
 
	Dimension sprite_size = GetSpriteSize(sprite);
 
	if (v->cur_order_index == order_index) {
 
		DrawSprite(sprite, PAL_NONE, rtl ? right - sprite_size.width : left, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
 
	}
 
@@ -941,13 +941,13 @@ public:
 
	}
 

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

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		SetDParam(0, 99);
 
		int index_column_width = GetStringBoundingBox(STR_ORDER_INDEX).width + GetSpriteSize(rtl ? SPR_ARROW_RIGHT : SPR_ARROW_LEFT).width + 3;
 
		int middle = rtl ? r.right - WD_FRAMETEXT_RIGHT - index_column_width : r.left + WD_FRAMETEXT_LEFT + index_column_width;
 

	
 
		int y = r.top + WD_FRAMERECT_TOP;
 
		int line_height = this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->resize_y;
src/roadveh_gui.cpp
Show inline comments
 
@@ -128,13 +128,13 @@ void DrawRoadVehDetails(const Vehicle *v
 
 * @param right     The maximum horizontal position
 
 * @param y         Vertical position to draw at
 
 * @param selection Selected vehicle to draw a frame around
 
 */
 
void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
 
{
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 
	Direction dir = rtl ? DIR_E : DIR_W;
 
	const RoadVehicle *u = RoadVehicle::From(v);
 

	
 
	int max_width = right - left + 1;
 
	int spent_width = 0;
 
	int pos = rtl ? right : left;
src/settings_gui.cpp
Show inline comments
 
@@ -1043,13 +1043,13 @@ SettingEntry *SettingEntry::FindEntry(ui
 
 * @return Row number of the next row to draw
 
 */
 
uint SettingEntry::Draw(GameSettings *settings_ptr, int left, int right, int base_y, uint first_row, uint max_row, uint cur_row, uint parent_last)
 
{
 
	if (cur_row >= max_row) return cur_row;
 

	
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 
	int offset = rtl ? -4 : 4;
 
	int level_width = rtl ? -LEVEL_WIDTH : LEVEL_WIDTH;
 

	
 
	int x = rtl ? right : left;
 
	int y = base_y;
 
	if (cur_row >= first_row) {
 
@@ -1123,13 +1123,13 @@ void SettingEntry::DrawSetting(GameSetti
 
{
 
	const SettingDescBase *sdb = &sd->desc;
 
	const void *var = ResolveVariableAddress(settings_ptr, sd);
 
	bool editable = true;
 
	bool disabled = false;
 

	
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 
	uint buttons_left = rtl ? right - 19 : left;
 
	uint text_left  = left + (rtl ? 0 : 25);
 
	uint text_right = right - (rtl ? 25 : 0);
 
	uint button_y = y + (SETTING_HEIGHT - 11) / 2;
 

	
 
	/* We do not allow changes of some items when we are a client in a networkgame */
 
@@ -1563,13 +1563,13 @@ struct GameSettingsWindow : Window {
 

	
 
		uint cur_row = 0;
 
		SettingEntry *pe = _settings_main_page.FindEntry(btn, &cur_row);
 

	
 
		if (pe == NULL) return;  // Clicked below the last setting of the page
 

	
 
		int x = (_dynlang.text_dir == TD_RTL ? this->width - pt.x : pt.x) - SETTINGTREE_LEFT_OFFSET - (pe->level + 1) * LEVEL_WIDTH;  // Shift x coordinate
 
		int x = (_current_text_dir == TD_RTL ? this->width - pt.x : pt.x) - SETTINGTREE_LEFT_OFFSET - (pe->level + 1) * LEVEL_WIDTH;  // Shift x coordinate
 
		if (x < 0) return;  // Clicked left of the entry
 

	
 
		if ((pe->flags & SEF_KIND_MASK) == SEF_SUBTREE_KIND) {
 
			pe->d.sub.folded = !pe->d.sub.folded; // Flip 'folded'-ness of the sub-page
 

	
 
			this->vscroll->SetCount(_settings_main_page.Length());
 
@@ -1628,13 +1628,13 @@ struct GameSettingsWindow : Window {
 
					/* Set up scroller timeout for numeric values */
 
					if (value != oldvalue && !(sd->desc.flags & SGF_MULTISTRING)) {
 
						if (this->clicked_entry != NULL) { // Release previous buttons if any
 
							this->clicked_entry->SetButtons(0);
 
						}
 
						this->clicked_entry = pe;
 
						this->clicked_entry->SetButtons((x >= 10) != (_dynlang.text_dir == TD_RTL) ? SEF_RIGHT_DEPRESSED : SEF_LEFT_DEPRESSED);
 
						this->clicked_entry->SetButtons((x >= 10) != (_current_text_dir == TD_RTL) ? SEF_RIGHT_DEPRESSED : SEF_LEFT_DEPRESSED);
 
						this->flags4 |= WF_TIMEOUT_BEGIN;
 
						_left_button_clicked = false;
 
					}
 
					break;
 
				}
 

	
 
@@ -1750,13 +1750,13 @@ void DrawArrowButtons(int x, int y, Colo
 
	DrawFrameRect(x,      y + 1, x +  9, y + 9, button_colour, (state == 1) ? FR_LOWERED : FR_NONE);
 
	DrawFrameRect(x + 10, y + 1, x + 19, y + 9, button_colour, (state == 2) ? FR_LOWERED : FR_NONE);
 
	DrawSprite(SPR_ARROW_LEFT, PAL_NONE, x + WD_IMGBTN_LEFT, y + WD_IMGBTN_TOP);
 
	DrawSprite(SPR_ARROW_RIGHT, PAL_NONE, x + WD_IMGBTN_LEFT + 10, y + WD_IMGBTN_TOP);
 

	
 
	/* Grey out the buttons that aren't clickable */
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 
	if (rtl ? !clickable_right : !clickable_left) {
 
		GfxFillRect(x +  1, y + 1, x +  1 + 8, y + 8, colour, FILLRECT_CHECKER);
 
	}
 
	if (rtl ? !clickable_left : !clickable_right) {
 
		GfxFillRect(x + 11, y + 1, x + 11 + 8, y + 8, colour, FILLRECT_CHECKER);
 
	}
src/ship_gui.cpp
Show inline comments
 
@@ -27,13 +27,13 @@
 
 * @param right     The maximum horizontal position
 
 * @param y         Vertical position to draw at
 
 * @param selection Selected vehicle to draw a frame around
 
 */
 
void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
 
{
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 

	
 
	SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W);
 
	const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
 

	
 
	int x = rtl ? right - real_sprite->width - real_sprite->x_offs : left - real_sprite->x_offs;
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -226,13 +226,13 @@ struct SignListWindow : QueryStringBaseW
 
				/* No signs? */
 
				if (this->vscroll->GetCount() == 0) {
 
					DrawString(r.left + WD_FRAMETEXT_LEFT, r.right, y, STR_STATION_LIST_NONE);
 
					return;
 
				}
 

	
 
				bool rtl = _dynlang.text_dir == TD_RTL;
 
				bool rtl = _current_text_dir == TD_RTL;
 
				int sprite_offset_y = (FONT_HEIGHT_NORMAL - 10) / 2 + 1;
 
				uint icon_left  = 4 + (rtl ? r.right - this->text_offset : r.left);
 
				uint text_left  = r.left + (rtl ? WD_FRAMERECT_LEFT : this->text_offset);
 
				uint text_right = r.right - (rtl ? this->text_offset : WD_FRAMERECT_RIGHT);
 

	
 
				/* At least one sign available. */
src/smallmap_gui.cpp
Show inline comments
 
@@ -1078,13 +1078,13 @@ public:
 
				break;
 
			}
 

	
 
			case SM_WIDGET_LEGEND: {
 
				uint columns = this->GetNumberColumnsLegend(r.right - r.left + 1);
 
				uint number_of_rows = max(this->map_type == SMT_INDUSTRY ? CeilDiv(_smallmap_industry_count, columns) : 0, this->min_number_of_fixed_rows);
 
				bool rtl = _dynlang.text_dir == TD_RTL;
 
				bool rtl = _current_text_dir == TD_RTL;
 
				uint y_org = r.top + WD_FRAMERECT_TOP;
 
				uint x = rtl ? r.right - this->column_width - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT;
 
				uint y = y_org;
 
				uint i = 0; // Row counter for industry legend.
 
				uint row_height = FONT_HEIGHT_SMALL;
 

	
 
@@ -1223,13 +1223,13 @@ public:
 
					const NWidgetBase *wi = this->GetWidget<NWidgetBase>(SM_WIDGET_LEGEND); // Label panel
 
					uint line = (pt.y - wi->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_SMALL;
 
					uint columns = this->GetNumberColumnsLegend(wi->current_x);
 
					uint number_of_rows = max(CeilDiv(_smallmap_industry_count, columns), this->min_number_of_fixed_rows);
 
					if (line >= number_of_rows) break;
 

	
 
					bool rtl = _dynlang.text_dir == TD_RTL;
 
					bool rtl = _current_text_dir == TD_RTL;
 
					int x = pt.x - wi->pos_x;
 
					if (rtl) x = wi->current_x - x;
 
					uint column = (x - WD_FRAMERECT_LEFT) / this->column_width;
 

	
 
					/* Check if click is on industry label*/
 
					int industry_pos = (column * number_of_rows) + line;
src/station_gui.cpp
Show inline comments
 
@@ -447,13 +447,13 @@ public:
 
			case SLW_SORTBY:
 
				/* draw arrow pointing up/down for ascending/descending sorting */
 
				this->DrawSortButtonState(SLW_SORTBY, this->stations.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
				break;
 

	
 
			case SLW_LIST: {
 
				bool rtl = _dynlang.text_dir == TD_RTL;
 
				bool rtl = _current_text_dir == TD_RTL;
 
				int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.Length());
 
				int y = r.top + WD_FRAMERECT_TOP;
 
				for (int i = this->vscroll->GetPosition(); i < max; ++i) { // do until max number of stations of owner
 
					const Station *st = this->stations[i];
 
					assert(st->xy != INVALID_TILE);
 

	
 
@@ -847,13 +847,13 @@ static void DrawCargoIcons(CargoID i, ui
 
{
 
	uint num = min((waiting + 5) / 10, (right - left) / 10); // maximum is width / 10 icons so it won't overflow
 
	if (num == 0) return;
 

	
 
	SpriteID sprite = CargoSpec::Get(i)->GetCargoIcon();
 

	
 
	int x = _dynlang.text_dir == TD_RTL ? right - num * 10 : left;
 
	int x = _current_text_dir == TD_RTL ? right - num * 10 : left;
 
	do {
 
		DrawSprite(sprite, PAL_NONE, x, y);
 
		x += 10;
 
	} while (--num);
 
}
 

	
 
@@ -1056,13 +1056,13 @@ struct StationViewWindow : public Window
 
			}
 
			SetDParam(0, str);
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_STATION_VIEW_WAITING_TITLE);
 
			y += FONT_HEIGHT_NORMAL;
 
		}
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		int text_left    = rtl ? r.left + this->expand_shrink_width : r.left + WD_FRAMERECT_LEFT;
 
		int text_right   = rtl ? r.right - WD_FRAMERECT_LEFT : r.right - this->expand_shrink_width;
 
		int shrink_left  = rtl ? r.left + WD_FRAMERECT_LEFT : r.right - this->expand_shrink_width + WD_FRAMERECT_LEFT;
 
		int shrink_right = rtl ? r.left + this->expand_shrink_width - WD_FRAMERECT_RIGHT : r.right - WD_FRAMERECT_RIGHT;
 

	
 

	
src/statusbar_gui.cpp
Show inline comments
 
@@ -59,20 +59,20 @@ static bool DrawScrollingStatusText(cons
 
	*d = '\0';
 

	
 
	DrawPixelInfo tmp_dpi;
 
	if (!FillDrawPixelInfo(&tmp_dpi, left, top, right - left, bottom)) return true;
 

	
 
	int width = GetStringBoundingBox(buffer).width;
 
	int pos = (_dynlang.text_dir == TD_RTL) ? (scroll_pos - width) : (right - scroll_pos - left);
 
	int pos = (_current_text_dir == TD_RTL) ? (scroll_pos - width) : (right - scroll_pos - left);
 

	
 
	DrawPixelInfo *old_dpi = _cur_dpi;
 
	_cur_dpi = &tmp_dpi;
 
	DrawString(pos, INT16_MAX, 0, buffer, TC_LIGHT_BLUE, SA_LEFT | SA_FORCE);
 
	_cur_dpi = old_dpi;
 

	
 
	return (_dynlang.text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0);
 
	return (_current_text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0);
 
}
 

	
 
enum StatusbarWidget {
 
	SBW_LEFT,   ///< left part of the statusbar; date is shown there
 
	SBW_MIDDLE, ///< middle part; current news or company name or *** SAVING *** or *** PAUSED ***
 
	SBW_RIGHT,  ///< right part; bank balance
src/strings.cpp
Show inline comments
 
@@ -37,14 +37,15 @@
 
#include "smallmap_gui.h"
 
#include "debug.h"
 

	
 
#include "table/strings.h"
 
#include "table/control_codes.h"
 

	
 
DynamicLanguages _dynlang;     ///< Language information of the program.
 
uint64 _decode_parameters[20]; ///< Global array of string parameters. To access, use #SetDParam.
 
DynamicLanguages _dynlang;       ///< Language information of the program.
 
TextDirection _current_text_dir; ///< Text direction of the currently selected language
 
uint64 _decode_parameters[20];   ///< Global array of string parameters. To access, use #SetDParam.
 

	
 
static char *StationGetSpecialString(char *buff, int x, const char *last);
 
static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char *last);
 
static char *GetSpecialNameString(char *buff, int ind, int64 *argv, const char *last);
 

	
 
static char *FormatString(char *buff, const char *str, int64 *argv, uint casei, const char *last);
 
@@ -1382,13 +1383,13 @@ bool ReadLanguagePack(int lang_index)
 
	_langpack_offs = langpack_offs;
 

	
 
	const char *c_file = strrchr(_dynlang.ent[lang_index].file, PATHSEPCHAR) + 1;
 
	strecpy(_dynlang.curr_file, c_file, lastof(_dynlang.curr_file));
 

	
 
	_dynlang.curr = lang_index;
 
	_dynlang.text_dir = (TextDirection)lang_pack->text_dir;
 
	_current_text_dir = (TextDirection)lang_pack->text_dir;
 
	SetCurrentGrfLangID(_langpack->newgrflangid);
 
	InitializeSortedCargoSpecs();
 
	SortIndustryTypes();
 
	BuildIndustriesLegend();
 
	SortNetworkLanguages();
 
	return true;
 
@@ -1698,13 +1699,13 @@ void CheckForMissingGlyphsInLoadedLangua
 
	 * otherwise we end up with a lot of artefacts. The colour
 
	 * 'character' might change in the future, so for safety
 
	 * we just Utf8 Encode it into the string, which takes
 
	 * exactly three characters, so it replaces the "XXX" with
 
	 * the colour marker.
 
	 */
 
	if (_dynlang.text_dir != TD_LTR) {
 
	if (_current_text_dir != TD_LTR) {
 
		static char *err_str = strdup("XXXThis version of OpenTTD does not support right-to-left languages. Recompile with icu enabled.");
 
		Utf8Encode(err_str, SCC_YELLOW);
 
		SetDParamStr(0, err_str);
 
		ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
 
	}
 
#endif
src/strings_func.h
Show inline comments
 
@@ -93,12 +93,13 @@ static inline void CopyOutDParam(uint64 
 
{
 
	extern uint64 _decode_parameters[20];
 
	memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num));
 
}
 

	
 
extern DynamicLanguages _dynlang; // defined in strings.cpp
 
extern TextDirection _current_text_dir; ///< Text direction of the currently selected language
 

	
 
bool ReadLanguagePack(int index);
 
void InitializeLanguagePacks();
 
const char *GetCurrentLanguageIsoCode();
 

	
 
int CDECL StringIDSorter(const StringID *a, const StringID *b);
src/strings_type.h
Show inline comments
 
@@ -34,13 +34,12 @@ struct Language {
 

	
 
/** Used for dynamic language support */
 
struct DynamicLanguages {
 
	int num;                  ///< Number of languages
 
	int curr;                 ///< Currently selected language index
 
	char curr_file[MAX_PATH]; ///< Currently selected language file name without path (needed for saving the filename of the loaded language).
 
	TextDirection text_dir;   ///< Text direction of the currently selected language
 
	Language ent[MAX_LANG];   ///< Information about the languages
 
};
 

	
 
/** Special string constants */
 
enum SpecialStrings {
 

	
src/terraform_gui.cpp
Show inline comments
 
@@ -370,13 +370,13 @@ Window *ShowTerraformToolbar(Window *lin
 
	DeleteWindowById(WC_SCEN_LAND_GEN, 0, true);
 
	w = AllocateWindowDescFront<TerraformToolbarWindow>(&_terraform_desc, 0);
 
	/* Align the terraform toolbar under the main toolbar. */
 
	w->top -= w->height;
 
	w->SetDirty();
 
	/* Put the linked toolbar to the left / right of it. */
 
	link->left = w->left + (_dynlang.text_dir == TD_RTL ? w->width : -link->width);
 
	link->left = w->left + (_current_text_dir == TD_RTL ? w->width : -link->width);
 
	link->top  = w->top;
 
	link->SetDirty();
 

	
 
	return w;
 
}
 

	
src/timetable_gui.cpp
Show inline comments
 
@@ -361,13 +361,13 @@ struct TimetableWindow : Window {
 
			case TTV_TIMETABLE_PANEL: {
 
				int y = r.top + WD_FRAMERECT_TOP;
 
				int i = this->vscroll->GetPosition();
 
				VehicleOrderID order_id = (i + 1) / 2;
 
				bool final_order = false;
 

	
 
				bool rtl = _dynlang.text_dir == TD_RTL;
 
				bool rtl = _current_text_dir == TD_RTL;
 
				SetDParam(0, 99);
 
				int index_column_width = GetStringBoundingBox(STR_ORDER_INDEX).width + GetSpriteSize(rtl ? SPR_ARROW_RIGHT : SPR_ARROW_LEFT).width + 3;
 
				int middle = rtl ? r.right - WD_FRAMERECT_RIGHT - index_column_width : r.left + WD_FRAMERECT_LEFT + index_column_width;
 

	
 
				const Order *order = v->GetOrder(order_id);
 
				while (order != NULL) {
 
@@ -423,13 +423,13 @@ struct TimetableWindow : Window {
 

	
 
				int y = r.top + WD_FRAMERECT_TOP;
 

	
 
				bool show_late = this->show_expected && v->lateness_counter > DAY_TICKS;
 
				Ticks offset = show_late ? 0 : -v->lateness_counter;
 

	
 
				bool rtl = _dynlang.text_dir == TD_RTL;
 
				bool rtl = _current_text_dir == TD_RTL;
 
				int abbr_left  = rtl ? r.right - WD_FRAMERECT_RIGHT - this->deparr_abbr_width : r.left + WD_FRAMERECT_LEFT;
 
				int abbr_right = rtl ? r.right - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT + this->deparr_abbr_width;
 
				int time_left  = rtl ? r.left + WD_FRAMERECT_LEFT : r.right - WD_FRAMERECT_RIGHT - this->deparr_time_width;
 
				int time_right = rtl ? r.left + WD_FRAMERECT_LEFT + this->deparr_time_width : r.right - WD_FRAMERECT_RIGHT;
 

	
 
				for (int i = this->vscroll->GetPosition(); i / 2 < v->GetNumOrders(); ++i) { // note: i is also incremented in the loop
src/toolbar_gui.cpp
Show inline comments
 
@@ -135,13 +135,13 @@ public:
 
	{
 
		return DropDownListStringItem::Width() + this->checkmark_width;
 
	}
 

	
 
	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;
 
		if (this->checked) {
 
			DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_JUST_CHECKMARK, sel ? TC_WHITE : TC_BLACK);
 
		}
 
		DrawString(left + WD_FRAMERECT_LEFT + (rtl ? 0 : this->checkmark_width), right - WD_FRAMERECT_RIGHT - (rtl ? this->checkmark_width : 0), top, this->String(), sel ? TC_WHITE : TC_BLACK);
 
	}
 
};
 
@@ -174,13 +174,13 @@ public:
 
		return GetStringBoundingBox(STR_COMPANY_NAME_COMPANY_NUM).width + this->icon_width + 3;
 
	}
 

	
 
	void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
	{
 
		CompanyID company = (CompanyID)this->result;
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 

	
 
		/* It's possible the company is deleted while the dropdown is open */
 
		if (!Company::IsValidID(company)) return;
 

	
 
		DrawCompanyIcon(company, rtl ? right - this->icon_width - WD_FRAMERECT_RIGHT : left + WD_FRAMERECT_LEFT, top + 1 + (FONT_HEIGHT_NORMAL - 10) / 2);
 

	
 
@@ -1051,13 +1051,13 @@ public:
 
	/* virtual */ void Draw(const Window *w)
 
	{
 
		/* Draw brown-red toolbar bg. */
 
		GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, 0xB2);
 
		GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, 0xB4, FILLRECT_CHECKER);
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		for (NWidgetBase *child_wid = rtl ? this->tail : this->head; child_wid != NULL; child_wid = rtl ? child_wid->prev : child_wid->next) {
 
			if (child_wid->type == NWID_SPACER) continue;
 
			if (!this->visible[((NWidgetCore*)child_wid)->index]) continue;
 

	
 
			child_wid->Draw(w);
 
		}
src/town_gui.cpp
Show inline comments
 
@@ -141,13 +141,13 @@ public:
 
		int icon_y_offset   = (FONT_HEIGHT_NORMAL - icon_size.height) / 2;
 

	
 
		Dimension exclusive_size = GetSpriteSize(SPR_EXCLUSIVE_TRANSPORT);
 
		int exclusive_width      = exclusive_size.width;
 
		int exclusive_y_offset   = (FONT_HEIGHT_NORMAL - exclusive_size.height) / 2;
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		uint text_left      = left  + (rtl ? 0 : icon_width + exclusive_width + 4);
 
		uint text_right     = right - (rtl ? icon_width + exclusive_width + 4 : 0);
 
		uint icon_left      = rtl ? right - icon_width : left;
 
		uint exclusive_left = rtl ? right - icon_width - exclusive_width - 2 : left + icon_width + 2;
 

	
 
		/* Draw list of companies */
 
@@ -395,13 +395,13 @@ public:
 
			default: break;
 
		}
 

	
 
		if (cargo_needed_for_growth > 0) {
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, y += FONT_HEIGHT_NORMAL, STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH);
 

	
 
			bool rtl = _dynlang.text_dir == TD_RTL;
 
			bool rtl = _current_text_dir == TD_RTL;
 
			uint cargo_text_left = r.left + WD_FRAMERECT_LEFT + (rtl ? 0 : 20);
 
			uint cargo_text_right = r.right - WD_FRAMERECT_RIGHT - (rtl ? 20 : 0);
 

	
 
			const CargoSpec *food = FindFirstCargoWithTownEffect(TE_FOOD);
 
			CargoID first_food_cargo = (food != NULL) ? food->Index() : (CargoID)CT_INVALID;
 
			StringID food_name       = (food != NULL) ? food->name    : STR_CARGO_PLURAL_FOOD;
src/train_gui.cpp
Show inline comments
 
@@ -52,13 +52,13 @@ void CcBuildWagon(const CommandCost &res
 
 * @param max_width The maximum space available to draw.
 
 * @param selection Selected vehicle that is dragged.
 
 * @return The width of the highlight mark.
 
 */
 
static int HighlightDragPosition(int px, int max_width, VehicleID selection)
 
{
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 

	
 
	assert(selection != INVALID_VEHICLE);
 
	Point offset;
 
	int dragged_width = Train::Get(selection)->GetDisplayImageWidth(&offset) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 

	
 
	int drag_hlight_left = rtl ? max(px -dragged_width, 0) : px;
 
@@ -82,13 +82,13 @@ static int HighlightDragPosition(int px,
 
 * @param selection Selected vehicle to draw a frame around
 
 * @param skip      Number of pixels to skip at the front (for scrolling)
 
 * @param drag_dest The vehicle another one is dragged over, \c INVALID_VEHICLE if none.
 
 */
 
void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID selection, int skip, VehicleID drag_dest)
 
{
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 
	Direction dir = rtl ? DIR_E : DIR_W;
 

	
 
	DrawPixelInfo tmp_dpi, *old_dpi;
 
	/* Position of highlight box */
 
	int highlight_l = 0;
 
	int highlight_r = 0;
 
@@ -332,13 +332,13 @@ int GetTrainDetailsWndVScroll(VehicleID 
 
 * @param det_tab Selected details tab
 
 */
 
void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_pos, uint16 vscroll_cap, TrainDetailsWindowTabs det_tab)
 
{
 
	/* draw the first 3 details tabs */
 
	if (det_tab != TDW_TAB_TOTALS) {
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		bool rtl = _current_text_dir == TD_RTL;
 
		Direction dir = rtl ? DIR_E : DIR_W;
 
		int x = rtl ? right : left;
 
		int sprite_y_offset = 4 + (FONT_HEIGHT_NORMAL - 10) / 2;
 
		int line_height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;
 
		for (; v != NULL && vscroll_pos > -vscroll_cap; v = v->GetNextVehicle()) {
 
			GetCargoSummaryOfArticulatedVehicle(v, &_cargo_summary);
src/vehicle_gui.cpp
Show inline comments
 
@@ -1029,13 +1029,13 @@ uint GetVehicleListHeight(VehicleType ty
 
 */
 
void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const
 
{
 
	int left = r.left + WD_MATRIX_LEFT;
 
	int right = r.right - WD_MATRIX_RIGHT;
 
	int width = right - left;
 
	bool rtl = _dynlang.text_dir == TD_RTL;
 
	bool rtl = _current_text_dir == TD_RTL;
 

	
 
	int text_offset = GetDigitWidth() * this->unitnumber_digits + WD_FRAMERECT_RIGHT;
 
	int text_left  = left  + (rtl ?           0 : text_offset);
 
	int text_right = right - (rtl ? text_offset :           0);
 

	
 
	bool show_orderlist = this->vli.vtype >= VEH_SHIP;
 
@@ -1736,13 +1736,13 @@ struct VehicleDetailsWindow : Window {
 
				/* For trains only. */
 
				DrawVehicleDetails(v, r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, r.top + WD_MATRIX_TOP, this->vscroll->GetPosition(), this->vscroll->GetCapacity(), this->tab);
 
				break;
 

	
 
			case VLD_WIDGET_MIDDLE_DETAILS: {
 
				/* For other vehicles, at the place of the matrix. */
 
				bool rtl = _dynlang.text_dir == TD_RTL;
 
				bool rtl = _current_text_dir == TD_RTL;
 
				uint sprite_width = max<uint>(GetSprite(v->GetImage(rtl ? DIR_E : DIR_W), ST_NORMAL)->width, 70U) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 

	
 
				uint text_left  = r.left  + (rtl ? 0 : sprite_width);
 
				uint text_right = r.right - (rtl ? sprite_width : 0);
 

	
 
				/* Articulated road vehicles use a complete line. */
src/widget.cpp
Show inline comments
 
@@ -49,13 +49,13 @@ static Point HandleScrollbarHittest(cons
 
	if (count != 0) top += height * pos / count;
 

	
 
	if (cap > count) cap = count;
 
	if (count != 0) bottom -= (count - pos - cap) * height / count;
 

	
 
	Point pt;
 
	if (horizontal && _dynlang.text_dir == TD_RTL) {
 
	if (horizontal && _current_text_dir == TD_RTL) {
 
		pt.x = rev_base - (bottom - 1);
 
		pt.y = rev_base - top;
 
	} else {
 
		pt.x = top;
 
		pt.y = bottom - 1;
 
	}
 
@@ -75,13 +75,13 @@ static void ScrollbarClickPositioning(Wi
 
{
 
	int pos;
 
	bool rtl = false;
 

	
 
	if (sb->type == NWID_HSCROLLBAR) {
 
		pos = x;
 
		rtl = _dynlang.text_dir == TD_RTL;
 
		rtl = _current_text_dir == TD_RTL;
 
	} else {
 
		pos = y;
 
	}
 
	if (pos <= mi + 9) {
 
		/* Pressing the upper button? */
 
		SetBit(sb->disp_flags, NDB_SCROLLBAR_UP);
 
@@ -384,13 +384,13 @@ static inline void DrawFrame(const Rect 
 

	
 
	/* If the frame has text, adjust the top bar to fit half-way through */
 
	int dy1 = 4;
 
	if (str != STR_NULL) dy1 = FONT_HEIGHT_NORMAL / 2 - 1;
 
	int dy2 = dy1 + 1;
 

	
 
	if (_dynlang.text_dir == TD_LTR) {
 
	if (_current_text_dir == TD_LTR) {
 
		/* Line from upper left corner to start of text */
 
		GfxFillRect(r.left, r.top + dy1, r.left + 4, r.top + dy1, c1);
 
		GfxFillRect(r.left + 1, r.top + dy2, r.left + 4, r.top + dy2, c2);
 

	
 
		/* Line from end of text to upper right corner */
 
		GfxFillRect(x2, r.top + dy1, r.right - 1, r.top + dy1, c1);
 
@@ -511,13 +511,13 @@ void DrawCaption(const Rect &r, Colours 
 
 * @param str              Text of the button.
 
 *
 
 * @note Magic constants are also used in #NWidgetLeaf::ButtonHit.
 
 */
 
static inline void DrawButtonDropdown(const Rect &r, Colours colour, bool clicked_button, bool clicked_dropdown, StringID str)
 
{
 
	if (_dynlang.text_dir == TD_LTR) {
 
	if (_current_text_dir == TD_LTR) {
 
		DrawFrameRect(r.left, r.top, r.right - 12, r.bottom, colour, clicked_button ? FR_LOWERED : FR_NONE);
 
		DrawFrameRect(r.right - 11, r.top, r.right, r.bottom, colour, clicked_dropdown ? FR_LOWERED : FR_NONE);
 
		DrawString(r.right - (clicked_dropdown ? 10 : 11), r.right, r.top + (clicked_dropdown ? 2 : 1), DOWNARROW, TC_BLACK, SA_HOR_CENTER);
 
		if (str != STR_NULL) DrawString(r.left + WD_DROPDOWNTEXT_LEFT + clicked_button, r.right - WD_DROPDOWNTEXT_RIGHT + clicked_button, r.top + WD_DROPDOWNTEXT_TOP + clicked_button, str, TC_BLACK);
 
	} else {
 
		DrawFrameRect(r.left + 12, r.top, r.right, r.bottom, colour, clicked_button ? FR_LOWERED : FR_NONE);
 
@@ -561,13 +561,13 @@ void Window::DrawSortButtonState(int wid
 
	if (state == SBS_OFF) return;
 

	
 
	assert(this->nested_array != NULL);
 
	const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
 

	
 
	int offset = this->IsWidgetLowered(widget) ? 1 : 0;
 
	int base = offset + nwid->pos_x + (_dynlang.text_dir == TD_LTR ? nwid->current_x - WD_SORTBUTTON_ARROW_WIDTH : 0);
 
	int base = offset + nwid->pos_x + (_current_text_dir == TD_LTR ? nwid->current_x - WD_SORTBUTTON_ARROW_WIDTH : 0);
 
	int top = nwid->pos_y;
 

	
 
	DrawString(base, base + WD_SORTBUTTON_ARROW_WIDTH, top + 1 + offset, state == SBS_DOWN ? DOWNARROW : UPARROW, TC_BLACK, SA_HOR_CENTER);
 
}
 

	
 

	
 
@@ -2011,14 +2011,14 @@ void NWidgetLeaf::Draw(const Window *w)
 
			break;
 

	
 
		case WWT_ARROWBTN:
 
		case WWT_PUSHARROWBTN: {
 
			SpriteID sprite;
 
			switch (this->widget_data) {
 
				case AWV_DECREASE: sprite = _dynlang.text_dir != TD_RTL ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT; break;
 
				case AWV_INCREASE: sprite = _dynlang.text_dir == TD_RTL ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT; break;
 
				case AWV_DECREASE: sprite = _current_text_dir != TD_RTL ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT; break;
 
				case AWV_INCREASE: sprite = _current_text_dir == TD_RTL ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT; break;
 
				case AWV_LEFT:     sprite = SPR_ARROW_LEFT;  break;
 
				case AWV_RIGHT:    sprite = SPR_ARROW_RIGHT; break;
 
				default: NOT_REACHED();
 
			}
 
			DrawImageButtons(r, WWT_PUSHIMGBTN, this->colour, clicked, sprite);
 
		}
 
@@ -2095,13 +2095,13 @@ void NWidgetLeaf::Draw(const Window *w)
 
 * @return The point refers to the button.
 
 *
 
 * @note The magic constants are also used at #DrawButtonDropdown.
 
 */
 
bool NWidgetLeaf::ButtonHit(const Point &pt)
 
{
 
	if (_dynlang.text_dir == TD_LTR) {
 
	if (_current_text_dir == TD_LTR) {
 
		int button_width = this->pos_x + this->current_x - 12;
 
		return pt.x < button_width;
 
	} else {
 
		int button_left = this->pos_x + 12;
 
		return pt.x >= button_left;
 
	}
src/widgets/dropdown.cpp
Show inline comments
 
@@ -410,13 +410,13 @@ void ShowDropDownList(Window *w, DropDow
 
			max_item_width += WD_VSCROLLBAR_WIDTH;
 
		}
 
	}
 

	
 
	if (auto_width) width = max(width, max_item_width);
 

	
 
	Point dw_pos = { w->left + (_dynlang.text_dir == TD_RTL ? wi_rect.right + 1 - width : wi_rect.left), top};
 
	Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - width : wi_rect.left), top};
 
	Dimension dw_size = {width, height};
 
	new DropdownWindow(w, list, selected, button, instant_close, dw_pos, dw_size, wi_colour, scroll);
 
}
 

	
 
/**
 
 * Show a dropdown menu window near a widget of the parent window.
src/window.cpp
Show inline comments
 
@@ -570,13 +570,13 @@ void Window::ReInit(int rx, int ry)
 
	int window_width  = this->width;
 
	int window_height = this->height;
 

	
 
	this->OnInit();
 
	/* Re-initialize the window from the ground up. No need to change the nested_array, as all widgets stay where they are. */
 
	this->nested_root->SetupSmallestSize(this, false);
 
	this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _dynlang.text_dir == TD_RTL);
 
	this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _current_text_dir == TD_RTL);
 
	this->width  = this->nested_root->smallest_x;
 
	this->height = this->nested_root->smallest_y;
 
	this->resize.step_width  = this->nested_root->resize_x;
 
	this->resize.step_height = this->nested_root->resize_y;
 

	
 
	/* Resize as close to the original size + requested resize as possible. */
 
@@ -904,13 +904,13 @@ void Window::InitializeData(const Window
 
		this->nested_array = CallocT<NWidgetBase *>(this->nested_array_size);
 
		this->nested_root->SetupSmallestSize(this, true);
 
	} else {
 
		this->nested_root->SetupSmallestSize(this, false);
 
	}
 
	/* Initialize to smallest size. */
 
	this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _dynlang.text_dir == TD_RTL);
 
	this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _current_text_dir == TD_RTL);
 

	
 
	/* Further set up window properties,
 
	 * this->left, this->top, this->width, this->height, this->resize.width, and this->resize.height are initialized later. */
 
	this->resize.step_width  = this->nested_root->resize_x;
 
	this->resize.step_height = this->nested_root->resize_y;
 

	
 
@@ -1183,13 +1183,13 @@ restart:
 
 * @return Coordinate of the top-left corner of the new window.
 
 */
 
Point GetToolbarAlignedWindowPosition(int window_width)
 
{
 
	const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
 
	assert(w != NULL);
 
	Point pt = { _dynlang.text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height };
 
	Point pt = { _current_text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height };
 
	return pt;
 
}
 

	
 
/**
 
 * Compute the position of the top-left corner of a new window that is opened.
 
 *
 
@@ -1591,13 +1591,13 @@ void ResizeWindow(Window *w, int delta_x
 

	
 
		uint new_xinc = max(0, (w->nested_root->resize_x == 0) ? 0 : (int)(w->nested_root->current_x - w->nested_root->smallest_x) + delta_x);
 
		uint new_yinc = max(0, (w->nested_root->resize_y == 0) ? 0 : (int)(w->nested_root->current_y - w->nested_root->smallest_y) + delta_y);
 
		assert(w->nested_root->resize_x == 0 || new_xinc % w->nested_root->resize_x == 0);
 
		assert(w->nested_root->resize_y == 0 || new_yinc % w->nested_root->resize_y == 0);
 

	
 
		w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _dynlang.text_dir == TD_RTL);
 
		w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _current_text_dir == TD_RTL);
 
		w->width  = w->nested_root->current_x;
 
		w->height = w->nested_root->current_y;
 
	}
 

	
 
	EnsureVisibleCaption(w, w->left, w->top);
 

	
 
@@ -1858,13 +1858,13 @@ static EventState HandleScrollbarScrolli
 
			int i;
 
			NWidgetScrollbar *sb = w->GetWidget<NWidgetScrollbar>(w->scrolling_scrollbar);
 
			bool rtl = false;
 

	
 
			if (sb->type == NWID_HSCROLLBAR) {
 
				i = _cursor.pos.x - _cursorpos_drag_start.x;
 
				rtl = _dynlang.text_dir == TD_RTL;
 
				rtl = _current_text_dir == TD_RTL;
 
			} else {
 
				i = _cursor.pos.y - _cursorpos_drag_start.y;
 
			}
 

	
 
			if (sb->disp_flags & ND_SCROLLBAR_BTN) {
 
				if (_scroller_click_timeout == 1) {
0 comments (0 inline, 0 general)